vp 번역 업데이트 과정 정리 (자뻑용)
우선 구버전 모드 폴더와 신버전 모드 폴더를 준비한다.
디렉터리 안의 어떤 내용이 없는 파일들 지우기 (tistory.com)
디렉터리 안의 어떤 내용이 없는 파일들 지우기
라는 기능이 필요해져서 (Language_en_US가 있는 언어 지원용 파일만 남기고 나머지 다 지우려고) 파워쉘로 어떻게 해보려고 찾아보고 있었는데... 아! 나 C# 할 줄 알았지! C#로 간단하게 만들었습니
hyuckkim.tistory.com
이걸로 번역에 필요한 파일들 빼고 다 지운다.
Dotnet 6.0이 있어야 실행되는 건 호환성이 너무 구린 거 같아서 러스트로 다시 짰다.
use std::io;
use std::io::BufRead;
use std::fs;
fn main() {
let path = get_cutstr("폴더 경로를 입력해주세요.");
let qstr = get_cutstr("포함되어야 하는 문자열을 입력해주세요.");
search_dir(&path, &qstr);
}
fn get_cutstr(guide: &str) -> String {
println!("{}", guide);
let mut newstr = String::new();
io::stdin().read_line(&mut newstr).expect("입력한 값을 읽지 못했습니다.");
newstr.trim().to_string()
}
fn search_dir(path: &String, q: &String) {
for file in fs::read_dir(path).unwrap() {
let link = file.unwrap().path();
let metadata = fs::metadata(&link).unwrap();
if metadata.is_dir() {
search_dir(&link.display().to_string(), q);
} else {
checks_file(&link.display().to_string(), q);
}
}
if fs::read_dir(path).unwrap().count() == 0 {
fs::remove_dir(path);
println!("폴더 {}이/가 삭제되었습니다.", path);
}
}
fn checks_file(path: &String, q: &String) {
let file = fs::File::open(path).unwrap();
let reader = io::BufReader::new(file);
// Read the file line by line using the lines() iterator from std::io::BufRead.
for (index, line) in reader.lines().enumerate() {
match line {
Ok(data) => {
if data.contains(q) {
return;
}
}
_ => {
break;
}
}
}
fs::remove_file(path);
println!("파일 {}이/가 삭제되었습니다.", path);
}
러스트니까 빌드 되면 오류 없다고 생각해도 된다. 휴!
Visual studio code의 확장 기능인 diff folders를 사용해 변경된 파일들을 확인한다.
Diff Folders - Visual Studio Marketplace
Diff Folders - Visual Studio Marketplace
Extension for Visual Studio Code - Compare two folders in Visual Studio Code
marketplace.visualstudio.com
달라진 부분을 번역 리포지토리에도 적용한다.
diff folder 개사기인듯.
막상 써놓고 보니 딱히 별 내용이 없군.