7z 생성 화면과 상황 시험을 연동함
- 작성자
- 호시노 히나타
- 작성 시각
- 커밋
41ac7e4dd6b6bf7de8c72c57fe2c3e1769be1da1- 부모
- a079705
변경된 파일 12개
+422-59| @@ -181,3 +181,14 @@ Ubuntu 제거 안내는 패키지 관리자 터미널 출력입니다. 이전 | ||
| 181 | 181 | - split-source-changed: 목록 이후 조각 변경 시 다시 열기 안내. |
| 182 | 182 | |
| 183 | 183 | 운영체제 기본 열기 창에서 같은 폴더의 첫 조각 `.7z.001`을 선택한다. 분할 묶음은 최대 999개이며 목록 열람 성공은 전체 데이터 무결성 검증 완료를 뜻하지 않는다. 실제 분할 파일 처리는 작업자 구현 후 독립 도구 표본으로 확인한다. Windows와 Wayland에서 첫 조각 선택, 누락 이름, .001 재시도 안내와 닫기를 확인하며, 위 디자인 상황은 실제 파일 검증을 대신하지 않는다. |
| 184 | 추가: | |
| 185 | 추가: ## 7z 만들기 상황 | |
| 186 | 추가: | |
| 187 | 추가: - create-sevenzip: 기존 만들기 창의 ZIP/7z 선택, LZMA2 고정과 암호 미지원 안내. | |
| 188 | 추가: - create-sevenzip-progress: 7z 생성 진행과 취소 버튼. | |
| 189 | 추가: - create-sevenzip-complete: 7z 파일의 저장 완료와 실제 저장 경로. | |
| 190 | 추가: - create-sevenzip-error: 7z 저장 실패와 재시도. | |
| 191 | 추가: - create-sevenzip-cancelled: 게시 전 취소 완료와 출력 없음. | |
| 192 | 추가: - create-sevenzip-resource: 7z 생성의 큰 작업 허용 질문. | |
| 193 | 추가: | |
| 194 | 추가: 7z를 선택하면 입력한 ZIP 암호와 실행 취소 기록을 지우며, ZIP으로 돌아와도 암호를 복원하지 않는다. 기본 저장 창은 .7z를 제안하며 암호가 필요하면 ZIP을 선택한다. 이 상황들은 가짜 작업자로 화면을 구성하므로 실제 7z 생성과 독립 도구 호환 시험을 대신하지 않는다. |
| @@ -8,6 +8,7 @@ pub enum Purpose { | ||
| 8 | 8 | Destination, |
| 9 | 9 | Retry, |
| 10 | 10 | SaveZip, |
| 11 | 추가: SaveSevenZip, | |
| 11 | 12 | SaveGzip, |
| 12 | 13 | RetryGzip, |
| 13 | 14 | } |
| @@ -110,6 +111,7 @@ fn choose_portal(request: DialogRequest) -> Result<Option<Vec<PathBuf>>, String> | ||
| 110 | 111 | let filters = match request.purpose { |
| 111 | 112 | Purpose::Open => archive_filters(), |
| 112 | 113 | Purpose::SaveZip => vec![("ZIP 압축파일", vec!["zip".into()])], |
| 114 | 추가: Purpose::SaveSevenZip => vec![("7z 압축파일", vec!["7z".into()])], | |
| 113 | 115 | _ => Vec::new(), |
| 114 | 116 | } |
| 115 | 117 | .into_iter() |
| @@ -128,18 +130,22 @@ fn choose_portal(request: DialogRequest) -> Result<Option<Vec<PathBuf>>, String> | ||
| 128 | 130 | .collect::<Vec<_>>(); |
| 129 | 131 | portal_response(pollster::block_on(async move { |
| 130 | 132 | let selected = match request.purpose { |
| 131 | 삭제: Purpose::SaveZip | Purpose::SaveGzip | Purpose::RetryGzip => SaveFileRequest::default() | |
| 132 | 삭제: .title(if request.purpose == Purpose::SaveZip { | |
| 133 | 삭제: "ZIP 파일 저장" | |
| 134 | 삭제: } else { | |
| 135 | 삭제: "압축 해제 파일 저장" | |
| 136 | 삭제: }) | |
| 137 | 삭제: .current_name(Some(request.file_name.as_str())) | |
| 138 | 삭제: .filters(filters) | |
| 139 | 삭제: .current_folder::<&PathBuf>(Some(&request.directory))? | |
| 140 | 삭제: .send() | |
| 141 | 삭제: .await? | |
| 142 | 삭제: .response()?, | |
| 133 | 추가: Purpose::SaveZip | Purpose::SaveSevenZip | Purpose::SaveGzip | Purpose::RetryGzip => { | |
| 134 | 추가: SaveFileRequest::default() | |
| 135 | 추가: .title(if request.purpose == Purpose::SaveSevenZip { | |
| 136 | 추가: "7z 파일 저장" | |
| 137 | 추가: } else if request.purpose == Purpose::SaveZip { | |
| 138 | 추가: "ZIP 파일 저장" | |
| 139 | 추가: } else { | |
| 140 | 추가: "압축 해제 파일 저장" | |
| 141 | 추가: }) | |
| 142 | 추가: .current_name(Some(request.file_name.as_str())) | |
| 143 | 추가: .filters(filters) | |
| 144 | 추가: .current_folder::<&PathBuf>(Some(&request.directory))? | |
| 145 | 추가: .send() | |
| 146 | 추가: .await? | |
| 147 | 추가: .response()? | |
| 148 | 추가: } | |
| 143 | 149 | purpose => OpenFileRequest::default() |
| 144 | 150 | .title(match purpose { |
| 145 | 151 | Purpose::Open => "압축파일 열기", |
| @@ -194,6 +200,12 @@ fn choose_native(request: DialogRequest) -> Result<Option<Vec<PathBuf>>, String> | ||
| 194 | 200 | .set_file_name(request.file_name) |
| 195 | 201 | .save_file() |
| 196 | 202 | .map(|path| vec![path]), |
| 203 | 추가: Purpose::SaveSevenZip => dialog | |
| 204 | 추가: .set_title("7z 파일 저장") | |
| 205 | 추가: .set_file_name(request.file_name) | |
| 206 | 추가: .add_filter("7z 압축파일", &["7z"]) | |
| 207 | 추가: .save_file() | |
| 208 | 추가: .map(|path| vec![path]), | |
| 197 | 209 | Purpose::SaveZip => dialog |
| 198 | 210 | .set_title("ZIP 파일 저장") |
| 199 | 211 | .set_file_name(request.file_name) |
| @@ -201,6 +201,24 @@ fn start_to_wire(start: ui::Start) -> wire::Start { | ||
| 201 | 201 | entry_id, |
| 202 | 202 | list_id: list_to_wire(list_id), |
| 203 | 203 | }, |
| 204 | 추가: ui::Start::CreateSevenZip { | |
| 205 | 추가: sources, | |
| 206 | 추가: output_file, | |
| 207 | 추가: } => wire::Action::CreateSevenZip { | |
| 208 | 추가: sources: sources | |
| 209 | 추가: .into_iter() | |
| 210 | 추가: .map(|(path, archive_name)| wire::Source { | |
| 211 | 추가: path: wire::NativePath::from_path(&crate::archive_path::worker_path(&path)), | |
| 212 | 추가: archive_name, | |
| 213 | 추가: }) | |
| 214 | 추가: .collect(), | |
| 215 | 추가: output_file: wire::NativePath::from_path(&crate::archive_path::worker_path( | |
| 216 | 추가: &output_file, | |
| 217 | 추가: )), | |
| 218 | 추가: method: wire::SevenZipMethod::Lzma2, | |
| 219 | 추가: solid: false, | |
| 220 | 추가: encryption: wire::Encryption::None, | |
| 221 | 추가: }, | |
| 204 | 222 | ui::Start::CreateZip { |
| 205 | 223 | sources, |
| 206 | 224 | output_file, |
| @@ -22,7 +22,7 @@ use std::{ | ||
| 22 | 22 | const WORK_WIDTH: f32 = 480.0; |
| 23 | 23 | const CREATE_WIDTH: f32 = 560.0; |
| 24 | 24 | /// 처음 열 때의 높이. 그다음부터는 내용 높이에 맞춤. |
| 25 | 삭제: const CREATE_MIN_HEIGHT: f32 = 300.0; | |
| 25 | 추가: const CREATE_MIN_HEIGHT: f32 = 560.0; | |
| 26 | 26 | const CREATE_LIST_HEIGHT: f32 = 288.0; |
| 27 | 27 | |
| 28 | 28 | /// ZIP 만들기 창 목록의 한 행. 디스크에서 읽은 파일이나 폴더임. |
| @@ -208,6 +208,7 @@ pub struct ArchiveApp { | ||
| 208 | 208 | create: bool, |
| 209 | 209 | selected_only: bool, |
| 210 | 210 | method: Method, |
| 211 | 추가: seven_zip: bool, | |
| 211 | 212 | dialogs: Box<dyn Dialogs>, |
| 212 | 213 | picker: Option<(Purpose, std::sync::mpsc::Receiver<DialogAnswer>)>, |
| 213 | 214 | preview_open: bool, |
| @@ -277,6 +278,7 @@ impl ArchiveApp { | ||
| 277 | 278 | create: false, |
| 278 | 279 | selected_only: false, |
| 279 | 280 | method: Method::Deflate, |
| 281 | 추가: seven_zip: false, | |
| 280 | 282 | dialogs: Box::new(NativeDialogs), |
| 281 | 283 | picker: None, |
| 282 | 284 | preview_open: false, |
| @@ -342,7 +344,7 @@ impl ArchiveApp { | ||
| 342 | 344 | pub fn show_create(&mut self, encrypted: bool) { |
| 343 | 345 | if !self.model.busy() { |
| 344 | 346 | self.create = true; |
| 345 | 삭제: self.aes256 = encrypted; | |
| 347 | 추가: self.aes256 = encrypted && !self.seven_zip; | |
| 346 | 348 | self.ui_error = None; |
| 347 | 349 | } |
| 348 | 350 | } |
| @@ -517,7 +519,11 @@ impl ArchiveApp { | ||
| 517 | 519 | } else { |
| 518 | 520 | first.file_stem() |
| 519 | 521 | }; |
| 520 | 삭제: self.zip_name = format!("{}.zip", name.unwrap_or_default().to_string_lossy()); | |
| 522 | 추가: self.zip_name = format!( | |
| 523 | 추가: "{}.{}", | |
| 524 | 추가: name.unwrap_or_default().to_string_lossy(), | |
| 525 | 추가: if self.seven_zip { "7z" } else { "zip" } | |
| 526 | 추가: ); | |
| 521 | 527 | } |
| 522 | 528 | } |
| 523 | 529 | for path in paths { |
| @@ -596,11 +602,12 @@ impl ArchiveApp { | ||
| 596 | 602 | if self.sources.is_empty() { |
| 597 | 603 | return; |
| 598 | 604 | } |
| 599 | 삭제: if !self.zip_name.to_ascii_lowercase().ends_with(".zip") { | |
| 600 | 삭제: self.zip_name.push_str(".zip"); | |
| 605 | 추가: let extension = if self.seven_zip { ".7z" } else { ".zip" }; | |
| 606 | 추가: if !self.zip_name.to_ascii_lowercase().ends_with(extension) { | |
| 607 | 추가: self.zip_name.push_str(extension); | |
| 601 | 608 | } |
| 602 | 609 | if !valid_leaf(&self.zip_name) { |
| 603 | 삭제: self.ui_error = Some("ZIP 파일 이름을 확인하세요".into()); | |
| 610 | 추가: self.ui_error = Some("압축파일 이름을 확인하세요".into()); | |
| 604 | 611 | return; |
| 605 | 612 | } |
| 606 | 613 | let output_file = self.zip_folder.join(&self.zip_name); |
| @@ -619,6 +626,15 @@ impl ArchiveApp { | ||
| 619 | 626 | }; |
| 620 | 627 | sources.push((path.clone(), name.to_owned())); |
| 621 | 628 | } |
| 629 | 추가: if self.seven_zip | |
| 630 | 추가: && (self.aes256 | |
| 631 | 추가: || !self.zip_password.is_empty() | |
| 632 | 추가: || !self.zip_password_confirm.is_empty()) | |
| 633 | 추가: { | |
| 634 | 추가: self.ui_error = | |
| 635 | 추가: Some("7z는 암호를 지원하지 않습니다. 암호가 필요하면 ZIP을 선택하세요".into()); | |
| 636 | 추가: return; | |
| 637 | 추가: } | |
| 622 | 638 | if !self.zip_password_ready() { |
| 623 | 639 | self.ui_error = Some("두 암호가 같은지 확인하세요".into()); |
| 624 | 640 | return; |
| @@ -627,12 +643,20 @@ impl ArchiveApp { | ||
| 627 | 643 | self.directories.clear(); |
| 628 | 644 | // 암호는 ZIP 만들기 창에서 받아 두었다가 작업자가 요청하면 넘김. |
| 629 | 645 | let password = self.aes256.then(|| std::mem::take(&mut self.zip_password)); |
| 630 | 삭제: if self.start(Start::CreateZip { | |
| 631 | 삭제: sources, | |
| 632 | 삭제: output_file, | |
| 633 | 삭제: method: self.method, | |
| 634 | 삭제: aes256: self.aes256, | |
| 635 | 삭제: }) { | |
| 646 | 추가: let request = if self.seven_zip { | |
| 647 | 추가: Start::CreateSevenZip { | |
| 648 | 추가: sources, | |
| 649 | 추가: output_file, | |
| 650 | 추가: } | |
| 651 | 추가: } else { | |
| 652 | 추가: Start::CreateZip { | |
| 653 | 추가: sources, | |
| 654 | 추가: output_file, | |
| 655 | 추가: method: self.method, | |
| 656 | 추가: aes256: self.aes256, | |
| 657 | 추가: } | |
| 658 | 추가: }; | |
| 659 | 추가: if self.start(request) { | |
| 636 | 660 | self.create = false; |
| 637 | 661 | self.create_win = WorkWindow::default(); |
| 638 | 662 | self.clear_zip_password(); |
| @@ -657,7 +681,7 @@ impl ArchiveApp { | ||
| 657 | 681 | _ => purpose, |
| 658 | 682 | }; |
| 659 | 683 | let directory = match purpose { |
| 660 | 삭제: Purpose::SaveZip => self.zip_folder.clone(), | |
| 684 | 추가: Purpose::SaveZip | Purpose::SaveSevenZip => self.zip_folder.clone(), | |
| 661 | 685 | Purpose::Destination | Purpose::SaveGzip => self |
| 662 | 686 | .model |
| 663 | 687 | .archive |
| @@ -769,8 +793,8 @@ impl ArchiveApp { | ||
| 769 | 793 | } |
| 770 | 794 | } |
| 771 | 795 | // 저장 위치를 고르는 사이 ZIP 만들기 창을 닫았으면 아무 작업도 시작하지 않음. |
| 772 | 삭제: Purpose::SaveZip if !self.create => {} | |
| 773 | 삭제: Purpose::SaveZip => { | |
| 796 | 추가: Purpose::SaveZip | Purpose::SaveSevenZip if !self.create => {} | |
| 797 | 추가: Purpose::SaveZip | Purpose::SaveSevenZip => { | |
| 774 | 798 | if let Some(name) = path.file_name().and_then(|name| name.to_str()) { |
| 775 | 799 | self.zip_name = name.to_owned(); |
| 776 | 800 | self.zip_folder = path.parent().unwrap_or(Path::new("/")).to_path_buf(); |
| @@ -799,7 +823,13 @@ impl ArchiveApp { | ||
| 799 | 823 | } |
| 800 | 824 | self.extract_selection(selection); |
| 801 | 825 | } |
| 826 | 추가: Start::CreateSevenZip { .. } => { | |
| 827 | 추가: self.set_seven_zip(true); | |
| 828 | 추가: self.create = true; | |
| 829 | 추가: self.begin_zip(); | |
| 830 | 추가: } | |
| 802 | 831 | Start::CreateZip { aes256, .. } => { |
| 832 | 추가: self.set_seven_zip(false); | |
| 803 | 833 | self.create = true; |
| 804 | 834 | if aes256 { |
| 805 | 835 | // 암호는 보관하지 않으므로 ZIP 만들기 창에서 다시 받음. |
| @@ -1867,7 +1897,10 @@ impl ArchiveApp { | ||
| 1867 | 1897 | let title = if self.model.busy() { |
| 1868 | 1898 | present::activity_text( |
| 1869 | 1899 | &self.model, |
| 1870 | 삭제: matches!(self.last_request, Some(Start::CreateZip { .. })), | |
| 1900 | 추가: matches!( | |
| 1901 | 추가: self.last_request, | |
| 1902 | 추가: Some(Start::CreateZip { .. } | Start::CreateSevenZip { .. }) | |
| 1903 | 추가: ), | |
| 1871 | 1904 | ) |
| 1872 | 1905 | .to_owned() |
| 1873 | 1906 | } else { |
| @@ -1959,7 +1992,10 @@ impl ArchiveApp { | ||
| 1959 | 1992 | if error.starts_with("암호는") { |
| 1960 | 1993 | error.as_str() |
| 1961 | 1994 | } else { |
| 1962 | 삭제: if matches!(self.last_request, Some(Start::CreateZip { .. })) { | |
| 1995 | 추가: if matches!( | |
| 1996 | 추가: self.last_request, | |
| 1997 | 추가: Some(Start::CreateZip { .. } | Start::CreateSevenZip { .. }) | |
| 1998 | 추가: ) { | |
| 1963 | 1999 | "저장 위치와 추가한 항목을 확인하세요" |
| 1964 | 2000 | } else { |
| 1965 | 2001 | "풀 위치와 선택한 항목을 확인하세요" |
| @@ -1977,7 +2013,10 @@ impl ArchiveApp { | ||
| 1977 | 2013 | }); |
| 1978 | 2014 | return; |
| 1979 | 2015 | } |
| 1980 | 삭제: let creating = matches!(self.last_request, Some(Start::CreateZip { .. })); | |
| 2016 | 추가: let creating = matches!( | |
| 2017 | 추가: self.last_request, | |
| 2018 | 추가: Some(Start::CreateZip { .. } | Start::CreateSevenZip { .. }) | |
| 2019 | 추가: ); | |
| 1981 | 2020 | let cancelling = self.model.cancellation_requested() || self.model.cancel.is_some(); |
| 1982 | 2021 | let title = present::activity_text(&self.model, creating); |
| 1983 | 2022 | ui.strong(title); |
| @@ -2034,7 +2073,10 @@ impl ArchiveApp { | ||
| 2034 | 2073 | fn result(&mut self, ui: &mut egui::Ui) { |
| 2035 | 2074 | let t = self.model.terminal.clone(); |
| 2036 | 2075 | let listing = matches!(self.last_request, Some(Start::List { .. })); |
| 2037 | 삭제: let creating = matches!(self.last_request, Some(Start::CreateZip { .. })); | |
| 2076 | 추가: let creating = matches!( | |
| 2077 | 추가: self.last_request, | |
| 2078 | 추가: Some(Start::CreateZip { .. } | Start::CreateSevenZip { .. }) | |
| 2079 | 추가: ); | |
| 2038 | 2080 | let resolved_targets = present::resolved_targets( |
| 2039 | 2081 | self.targets.as_ref(), |
| 2040 | 2082 | &self.model.entries, |
| @@ -2087,7 +2129,11 @@ impl ArchiveApp { | ||
| 2087 | 2129 | self.model.confirmed && t.as_ref().is_some_and(|t| t.outcome == Outcome::Cancelled); |
| 2088 | 2130 | let title = if success { |
| 2089 | 2131 | if creating { |
| 2090 | 삭제: "ZIP 파일을 만들었습니다" | |
| 2132 | 추가: if matches!(self.last_request, Some(Start::CreateSevenZip { .. })) { | |
| 2133 | 추가: "7z 파일을 만들었습니다" | |
| 2134 | 추가: } else { | |
| 2135 | 추가: "ZIP 파일을 만들었습니다" | |
| 2136 | 추가: } | |
| 2091 | 2137 | } else if skipped > 0 && t.as_ref().is_some_and(|t| t.created_count == 0) { |
| 2092 | 2138 | "모든 파일을 건너뛰었습니다" |
| 2093 | 2139 | } else { |
| @@ -2098,7 +2144,11 @@ impl ArchiveApp { | ||
| 2098 | 2144 | } else if listing { |
| 2099 | 2145 | "압축파일을 열지 못했습니다" |
| 2100 | 2146 | } else if creating { |
| 2101 | 삭제: "ZIP 파일을 만들지 못했습니다" | |
| 2147 | 추가: if matches!(self.last_request, Some(Start::CreateSevenZip { .. })) { | |
| 2148 | 추가: "7z 파일을 만들지 못했습니다" | |
| 2149 | 추가: } else { | |
| 2150 | 추가: "ZIP 파일을 만들지 못했습니다" | |
| 2151 | 추가: } | |
| 2102 | 2152 | } else { |
| 2103 | 2153 | "압축을 풀지 못했습니다" |
| 2104 | 2154 | }; |
| @@ -2136,9 +2186,10 @@ impl ArchiveApp { | ||
| 2136 | 2186 | .show(ui, |ui| { |
| 2137 | 2187 | if success && t.as_ref().is_some_and(|t| t.created_count > 0) { |
| 2138 | 2188 | let path = match self.last_request.as_ref() { |
| 2139 | 삭제: Some(Start::CreateZip { output_file, .. }) => { | |
| 2140 | 삭제: output_file.display().to_string() | |
| 2141 | 삭제: } | |
| 2189 | 추가: Some( | |
| 2190 | 추가: Start::CreateZip { output_file, .. } | |
| 2191 | 추가: | Start::CreateSevenZip { output_file, .. }, | |
| 2192 | 추가: ) => output_file.display().to_string(), | |
| 2142 | 2193 | _ => format!("{} 폴더에 저장했습니다.", self.destination.display()), |
| 2143 | 2194 | }; |
| 2144 | 2195 | theme::bounded_text(ui, &path, ui.available_width()); |
| @@ -2204,7 +2255,11 @@ impl ArchiveApp { | ||
| 2204 | 2255 | ) |
| 2205 | 2256 | { |
| 2206 | 2257 | ui.label(if creating { |
| 2207 | 삭제: "ZIP 파일을 만들지 않았습니다" | |
| 2258 | 추가: if matches!(self.last_request, Some(Start::CreateSevenZip { .. })) { | |
| 2259 | 추가: "7z 파일을 만들지 않았습니다" | |
| 2260 | 추가: } else { | |
| 2261 | 추가: "ZIP 파일을 만들지 않았습니다" | |
| 2262 | 추가: } | |
| 2208 | 2263 | } else { |
| 2209 | 2264 | "아무 파일도 풀지 않았습니다" |
| 2210 | 2265 | }); |
| @@ -2376,9 +2431,10 @@ impl ArchiveApp { | ||
| 2376 | 2431 | } |
| 2377 | 2432 | if folder { |
| 2378 | 2433 | let path = match self.last_request.as_ref() { |
| 2379 | 삭제: Some(Start::CreateZip { output_file, .. }) => { | |
| 2380 | 삭제: output_file.parent().unwrap_or(Path::new("/")) | |
| 2381 | 삭제: } | |
| 2434 | 추가: Some( | |
| 2435 | 추가: Start::CreateZip { output_file, .. } | |
| 2436 | 추가: | Start::CreateSevenZip { output_file, .. }, | |
| 2437 | 추가: ) => output_file.parent().unwrap_or(Path::new("/")), | |
| 2382 | 2438 | _ => self.destination.as_path(), |
| 2383 | 2439 | }; |
| 2384 | 2440 | match present::folder_command(path).spawn() { |
| @@ -2432,7 +2488,11 @@ impl ArchiveApp { | ||
| 2432 | 2488 | let modal = egui::Modal::new(egui::Id::unique("create-zip")).show(ctx, |ui| { |
| 2433 | 2489 | ui.set_width((ctx.content_rect().width() - 64.0).min(CREATE_WIDTH)); |
| 2434 | 2490 | ui.horizontal(|ui| { |
| 2435 | 삭제: ui.heading("ZIP 만들기"); | |
| 2491 | 추가: ui.heading(if self.seven_zip { | |
| 2492 | 추가: "7z 만들기" | |
| 2493 | 추가: } else { | |
| 2494 | 추가: "ZIP 만들기" | |
| 2495 | 추가: }); | |
| 2436 | 2496 | ui.with_layout(Layout::right_to_left(Align::Center), |ui| { |
| 2437 | 2497 | let button = theme::icon_button(ui, "닫기", theme::CLOSE, true); |
| 2438 | 2498 | close = button.clicked(); |
| @@ -2448,7 +2508,11 @@ impl ArchiveApp { | ||
| 2448 | 2508 | return; |
| 2449 | 2509 | } |
| 2450 | 2510 | let id = egui::ViewportId::from_hash_of("archive-create"); |
| 2451 | 삭제: let title = "ZIP 만들기 — Zipelo"; | |
| 2511 | 추가: let title = if self.seven_zip { | |
| 2512 | 추가: "7z 만들기 — Zipelo" | |
| 2513 | 추가: } else { | |
| 2514 | 추가: "ZIP 만들기 — Zipelo" | |
| 2515 | 추가: }; | |
| 2452 | 2516 | let custom_frame = self.custom_frame; |
| 2453 | 2517 | if !self.create_win.open { |
| 2454 | 2518 | self.create_win.height = self.create_win.height.max(CREATE_MIN_HEIGHT); |
| @@ -2531,7 +2595,38 @@ impl ArchiveApp { | ||
| 2531 | 2595 | .inner |
| 2532 | 2596 | } |
| 2533 | 2597 | |
| 2598 | 추가: fn set_seven_zip(&mut self, selected: bool) { | |
| 2599 | 추가: if self.seven_zip == selected { | |
| 2600 | 추가: return; | |
| 2601 | 추가: } | |
| 2602 | 추가: self.seven_zip = selected; | |
| 2603 | 추가: self.aes256 = false; | |
| 2604 | 추가: self.clear_zip_password(); | |
| 2605 | 추가: self.ui_error = None; | |
| 2606 | 추가: let name = self.zip_name.clone(); | |
| 2607 | 추가: let lower = name.to_ascii_lowercase(); | |
| 2608 | 추가: let stem = if lower.ends_with(".zip") { | |
| 2609 | 추가: &name[..name.len() - 4] | |
| 2610 | 추가: } else if lower.ends_with(".7z") { | |
| 2611 | 추가: &name[..name.len() - 3] | |
| 2612 | 추가: } else { | |
| 2613 | 추가: &name | |
| 2614 | 추가: }; | |
| 2615 | 추가: self.zip_name = format!("{stem}{}", if selected { ".7z" } else { ".zip" }); | |
| 2616 | 추가: } | |
| 2617 | 추가: | |
| 2534 | 2618 | fn create_contents(&mut self, ui: &mut egui::Ui) -> bool { |
| 2619 | 추가: let mut selected = self.seven_zip; | |
| 2620 | 추가: ui.horizontal(|ui| { | |
| 2621 | 추가: ui.label("형식"); | |
| 2622 | 추가: ui.selectable_value(&mut selected, false, "ZIP"); | |
| 2623 | 추가: ui.selectable_value(&mut selected, true, "7z"); | |
| 2624 | 추가: if selected { | |
| 2625 | 추가: ui.label("LZMA2"); | |
| 2626 | 추가: } | |
| 2627 | 추가: }); | |
| 2628 | 추가: self.set_seven_zip(selected); | |
| 2629 | 추가: | |
| 2535 | 2630 | let rows = self.create_rows(); |
| 2536 | 2631 | let root = self.create_root(); |
| 2537 | 2632 | |
| @@ -2670,6 +2765,10 @@ impl ArchiveApp { | ||
| 2670 | 2765 | } |
| 2671 | 2766 | |
| 2672 | 2767 | // 암호: 체크하면 바로 아래에 암호와 암호 확인 칸을 보여 줌. |
| 2768 | 추가: if self.seven_zip { | |
| 2769 | 추가: ui.label("7z는 암호를 지원하지 않습니다. 암호가 필요하면 ZIP을 선택하세요"); | |
| 2770 | 추가: return false; | |
| 2771 | 추가: } | |
| 2673 | 2772 | let check = ui.checkbox(&mut self.aes256, "암호로 보호하기"); |
| 2674 | 2773 | theme::pointer(&check); |
| 2675 | 2774 | theme::focus(&check); |
| @@ -2743,7 +2842,11 @@ impl ArchiveApp { | ||
| 2743 | 2842 | }) |
| 2744 | 2843 | .inner; |
| 2745 | 2844 | if compress { |
| 2746 | 삭제: self.open_picker(Purpose::SaveZip); | |
| 2845 | 추가: self.open_picker(if self.seven_zip { | |
| 2846 | 추가: Purpose::SaveSevenZip | |
| 2847 | 추가: } else { | |
| 2848 | 추가: Purpose::SaveZip | |
| 2849 | 추가: }); | |
| 2747 | 2850 | } |
| 2748 | 2851 | cancel |
| 2749 | 2852 | } |
| @@ -2769,6 +2872,7 @@ impl ArchiveApp { | ||
| 2769 | 2872 | ActionKind::List => "압축파일 목록 열기", |
| 2770 | 2873 | ActionKind::Extract => "압축 해제", |
| 2771 | 2874 | ActionKind::CreateZip => "ZIP 만들기", |
| 2875 | 추가: ActionKind::CreateSevenZip => "7z 만들기", | |
| 2772 | 2876 | ActionKind::Preview => "파일 미리보기", |
| 2773 | 2877 | }); |
| 2774 | 2878 | if question.scope.ratio { |
| @@ -69,6 +69,10 @@ pub enum Start { | ||
| 69 | 69 | entry_id: u32, |
| 70 | 70 | list_id: ListId, |
| 71 | 71 | }, |
| 72 | 추가: CreateSevenZip { | |
| 73 | 추가: sources: Vec<(PathBuf, String)>, | |
| 74 | 추가: output_file: PathBuf, | |
| 75 | 추가: }, | |
| 72 | 76 | CreateZip { |
| 73 | 77 | sources: Vec<(PathBuf, String)>, |
| 74 | 78 | output_file: PathBuf, |
| @@ -476,7 +480,8 @@ impl Model { | ||
| 476 | 480 | } |
| 477 | 481 | } |
| 478 | 482 | pub fn begin(&mut self, start: Start, factory: &mut dyn Factory) -> bool { |
| 479 | 삭제: let expanded = self.needs_expansion(&start); | |
| 483 | 추가: let expanded = | |
| 484 | 추가: matches!(start, Start::CreateSevenZip { .. }) || self.needs_expansion(&start); | |
| 480 | 485 | self.begin_with_limits(start, factory, expanded) |
| 481 | 486 | } |
| 482 | 487 | pub fn estimated_usage(&self) -> ResourceUsage { |
| @@ -513,7 +518,7 @@ impl Model { | ||
| 513 | 518 | .iter() |
| 514 | 519 | .try_fold(0u64, |sum, e| sum.checked_add(e.bytes?)); |
| 515 | 520 | } |
| 516 | 삭제: Start::CreateZip { sources, .. } => { | |
| 521 | 추가: Start::CreateZip { sources, .. } | Start::CreateSevenZip { sources, .. } => { | |
| 517 | 522 | usage.estimated_bytes = sources.iter().try_fold(0u64, |sum, (path, _)| { |
| 518 | 523 | let m = std::fs::symlink_metadata(path).ok()?; |
| 519 | 524 | if !m.is_file() { |
| @@ -643,6 +648,10 @@ impl Model { | ||
| 643 | 648 | sources, |
| 644 | 649 | output_file, |
| 645 | 650 | .. |
| 651 | 추가: } | |
| 652 | 추가: | Start::CreateSevenZip { | |
| 653 | 추가: sources, | |
| 654 | 추가: output_file, | |
| 646 | 655 | } => { |
| 647 | 656 | !sources.is_empty() |
| 648 | 657 | && output_file.is_absolute() |
| @@ -1100,6 +1109,9 @@ impl Model { | ||
| 1100 | 1109 | } |
| 1101 | 1110 | } |
| 1102 | 1111 | Event::Accepted { encryption } => { |
| 1112 | 추가: if matches!(run.start, Start::CreateSevenZip { .. }) && encryption { | |
| 1113 | 추가: self.error = Some("7z 생성의 암호 응답이 유효하지 않습니다".into()); | |
| 1114 | 추가: } | |
| 1103 | 1115 | if run.accepted { |
| 1104 | 1116 | self.error = Some("작업 승인 중복".into()); |
| 1105 | 1117 | } |
| @@ -1144,7 +1156,8 @@ impl Model { | ||
| 1144 | 1156 | if run.cancel_sequence.is_some() { |
| 1145 | 1157 | return; |
| 1146 | 1158 | } |
| 1147 | 삭제: if self.challenge.is_some() | |
| 1159 | 추가: if matches!(run.start, Start::CreateSevenZip { .. }) | |
| 1160 | 추가: || self.challenge.is_some() | |
| 1148 | 1161 | || self.resource.is_some() |
| 1149 | 1162 | || challenge_id <= run.last_challenge |
| 1150 | 1163 | || self.conflict.is_some() |
| @@ -1163,6 +1176,7 @@ impl Model { | ||
| 1163 | 1176 | Start::List { .. } => ActionKind::List, |
| 1164 | 1177 | Start::Extract { .. } => ActionKind::Extract, |
| 1165 | 1178 | Start::CreateZip { .. } => ActionKind::CreateZip, |
| 1179 | 추가: Start::CreateSevenZip { .. } => ActionKind::CreateSevenZip, | |
| 1166 | 1180 | Start::Preview { .. } => ActionKind::Preview, |
| 1167 | 1181 | }; |
| 1168 | 1182 | let hard = Limits { |
| @@ -236,6 +236,11 @@ impl Connection for CaptureConnection { | ||
| 236 | 236 | durability: Durability::NotApplicable, |
| 237 | 237 | cleanup: Cleanup::Complete, |
| 238 | 238 | }), |
| 239 | 추가: Start::CreateSevenZip { output_file, .. } => { | |
| 240 | 추가: self.create_name = | |
| 241 | 추가: Some(output_file.file_name().unwrap().to_string_lossy().into()); | |
| 242 | 추가: self.finish(false); | |
| 243 | 추가: } | |
| 239 | 244 | Start::CreateZip { |
| 240 | 245 | output_file, |
| 241 | 246 | aes256, |
| @@ -107,3 +107,36 @@ fn volume_problem_adapter_preserves_native_filename_and_rejects_other_actions() | ||
| 107 | 107 | Some(ui::ErrorCode::MissingVolume) |
| 108 | 108 | ); |
| 109 | 109 | } |
| 110 | 추가: | |
| 111 | 추가: #[test] | |
| 112 | 추가: fn sevenzip_creation_adapter_preserves_paths_and_fixed_options() { | |
| 113 | 추가: let source = std::env::current_dir().unwrap().join("원본"); | |
| 114 | 추가: let output = source.with_file_name("결과.7z"); | |
| 115 | 추가: let converted = start_to_wire(ui::Start::CreateSevenZip { | |
| 116 | 추가: sources: vec![(source.clone(), "원본".into())], | |
| 117 | 추가: output_file: output.clone(), | |
| 118 | 추가: }); | |
| 119 | 추가: match converted.action { | |
| 120 | 추가: wire::Action::CreateSevenZip { | |
| 121 | 추가: sources, | |
| 122 | 추가: output_file, | |
| 123 | 추가: method, | |
| 124 | 추가: solid, | |
| 125 | 추가: encryption, | |
| 126 | 추가: } => { | |
| 127 | 추가: assert_eq!(sources[0].archive_name, "원본"); | |
| 128 | 추가: assert_eq!( | |
| 129 | 추가: sources[0].path, | |
| 130 | 추가: wire::NativePath::from_path(&crate::archive_path::worker_path(&source)) | |
| 131 | 추가: ); | |
| 132 | 추가: assert_eq!( | |
| 133 | 추가: output_file, | |
| 134 | 추가: wire::NativePath::from_path(&crate::archive_path::worker_path(&output)) | |
| 135 | 추가: ); | |
| 136 | 추가: assert_eq!(method, wire::SevenZipMethod::Lzma2); | |
| 137 | 추가: assert!(!solid); | |
| 138 | 추가: assert_eq!(encryption, wire::Encryption::None); | |
| 139 | 추가: } | |
| 140 | 추가: other => panic!("잘못된 생성 형식: {other:?}"), | |
| 141 | 추가: } | |
| 142 | 추가: } |
| @@ -636,3 +636,49 @@ fn native_picker_lowers_child_windows_and_restores_their_position_and_level() { | ||
| 636 | 636 | } |
| 637 | 637 | } |
| 638 | 638 | } |
| 639 | 추가: | |
| 640 | 추가: #[test] | |
| 641 | 추가: fn sevenzip_selection_clears_zip_password_and_sends_only_supported_options() { | |
| 642 | 추가: let scratch = Folder::new(); | |
| 643 | 추가: let factory = FakeFactory::default(); | |
| 644 | 추가: let (mut app, ctx) = create_from_folder(&scratch, &factory); | |
| 645 | 추가: policy_click(&ctx, &mut app, "암호로 보호하기"); | |
| 646 | 추가: text(&ctx, &mut app, "zip-password-input", "previous-secret"); | |
| 647 | 추가: text(&ctx, &mut app, "zip-password-confirm", "previous-secret"); | |
| 648 | 추가: policy_click(&ctx, &mut app, "7z"); | |
| 649 | 추가: let shown = policy_render(&ctx, &mut app, vec![]); | |
| 650 | 추가: assert!(shown.iter().any(|(s, _)| s == "LZMA2")); | |
| 651 | 추가: assert!(!shown.iter().any(|(s, _)| s == "암호 확인")); | |
| 652 | 추가: policy_click(&ctx, &mut app, "ZIP"); | |
| 653 | 추가: policy_click(&ctx, &mut app, "암호로 보호하기"); | |
| 654 | 추가: policy_click(&ctx, &mut app, "압축하기"); | |
| 655 | 추가: assert_eq!(factory.state.borrow().starts.len(), 1); | |
| 656 | 추가: policy_click(&ctx, &mut app, "7z"); | |
| 657 | 추가: let dialogs = TestDialogs::default(); | |
| 658 | 추가: app.set_dialogs(Box::new(dialogs.clone())); | |
| 659 | 추가: policy_click(&ctx, &mut app, "압축하기"); | |
| 660 | 추가: let state = dialogs.0.borrow(); | |
| 661 | 추가: let save = state.requests.last().unwrap(); | |
| 662 | 추가: assert_eq!(save.purpose, Purpose::SaveSevenZip); | |
| 663 | 추가: assert_eq!(save.file_name, "photos.7z"); | |
| 664 | 추가: assert!(matches!(factory.state.borrow().starts.last(), | |
| 665 | 추가: Some(Start::CreateSevenZip { sources, output_file }) | |
| 666 | 추가: if sources.len() == 1 && sources[0].1 == "photos" && output_file.ends_with("photos.7z"))); | |
| 667 | 추가: assert!(!factory.state.borrow().password_seen); | |
| 668 | 추가: } | |
| 669 | 추가: | |
| 670 | 추가: #[test] | |
| 671 | 추가: fn cancelling_sevenzip_save_keeps_selected_format_without_starting() { | |
| 672 | 추가: let scratch = Folder::new(); | |
| 673 | 추가: let factory = FakeFactory::default(); | |
| 674 | 추가: let (mut app, ctx) = create_from_folder(&scratch, &factory); | |
| 675 | 추가: policy_click(&ctx, &mut app, "7z"); | |
| 676 | 추가: let dialogs = TestDialogs::default(); | |
| 677 | 추가: dialogs.0.borrow_mut().cancel_save = true; | |
| 678 | 추가: app.set_dialogs(Box::new(dialogs)); | |
| 679 | 추가: policy_click(&ctx, &mut app, "압축하기"); | |
| 680 | 추가: assert_eq!(factory.state.borrow().starts.len(), 1); | |
| 681 | 추가: let shown = policy_render(&ctx, &mut app, vec![]); | |
| 682 | 추가: assert!(shown.iter().any(|(s, _)| s == "7z 만들기")); | |
| 683 | 추가: assert!(shown.iter().any(|(s, _)| s == "LZMA2")); | |
| 684 | 추가: } |
| @@ -23,7 +23,8 @@ impl Dialogs for TestDialogs { | ||
| 23 | 23 | if let Some(answer) = state.answers.pop_front() { |
| 24 | 24 | return Ok(answer); |
| 25 | 25 | } |
| 26 | 삭제: if request.purpose == Purpose::SaveZip && !state.cancel_save { | |
| 26 | 추가: if matches!(request.purpose, Purpose::SaveZip | Purpose::SaveSevenZip) && !state.cancel_save | |
| 27 | 추가: { | |
| 27 | 28 | let name = state.save_name.take().unwrap_or(request.file_name); |
| 28 | 29 | return Ok(Some(vec![request.directory.join(name)])); |
| 29 | 30 | } |
| @@ -875,3 +875,81 @@ mod presentation; | ||
| 875 | 875 | mod windows_paths; |
| 876 | 876 | |
| 877 | 877 | mod guarded; |
| 878 | 추가: | |
| 879 | 추가: #[test] | |
| 880 | 추가: fn sevenzip_creation_rejects_password_prompts_and_encrypted_acceptance() { | |
| 881 | 추가: for encrypted in [false, true] { | |
| 882 | 추가: let mut f = FakeFactory::default(); | |
| 883 | 추가: f.state.borrow_mut().manual = true; | |
| 884 | 추가: let mut m = Model::default(); | |
| 885 | 추가: assert!(m.begin( | |
| 886 | 추가: Start::CreateSevenZip { | |
| 887 | 추가: sources: vec![(path("source"), "source".into())], | |
| 888 | 추가: output_file: path("output.7z"), | |
| 889 | 추가: }, | |
| 890 | 추가: &mut f | |
| 891 | 추가: )); | |
| 892 | 추가: f.state.borrow_mut().frame(Event::Accepted { | |
| 893 | 추가: encryption: encrypted, | |
| 894 | 추가: }); | |
| 895 | 추가: if !encrypted { | |
| 896 | 추가: f.state.borrow_mut().frame(Event::PasswordRequired { | |
| 897 | 추가: challenge_id: 1, | |
| 898 | 추가: attempt: 1, | |
| 899 | 추가: encrypt: true, | |
| 900 | 추가: }); | |
| 901 | 추가: } | |
| 902 | 추가: for _ in 0..10 { | |
| 903 | 추가: m.poll(); | |
| 904 | 추가: } | |
| 905 | 추가: assert!(m.error.is_some()); | |
| 906 | 추가: assert!(m.challenge.is_none()); | |
| 907 | 추가: } | |
| 908 | 추가: } | |
| 909 | 추가: | |
| 910 | 추가: #[test] | |
| 911 | 추가: fn sevenzip_creation_waits_for_both_eofs_and_child_reap() { | |
| 912 | 추가: let mut f = FakeFactory::default(); | |
| 913 | 추가: f.state.borrow_mut().manual = true; | |
| 914 | 추가: let mut m = Model::default(); | |
| 915 | 추가: assert!(m.begin( | |
| 916 | 추가: Start::CreateSevenZip { | |
| 917 | 추가: sources: vec![(path("source"), "source".into())], | |
| 918 | 추가: output_file: path("output.7z"), | |
| 919 | 추가: }, | |
| 920 | 추가: &mut f | |
| 921 | 추가: )); | |
| 922 | 추가: { | |
| 923 | 추가: let mut s = f.state.borrow_mut(); | |
| 924 | 추가: s.frame(Event::Accepted { encryption: false }); | |
| 925 | 추가: s.frame(Event::Output { | |
| 926 | 추가: entry_id: None, | |
| 927 | 추가: relative_name: "output.7z".into(), | |
| 928 | 추가: disposition: Disposition::Created, | |
| 929 | 추가: }); | |
| 930 | 추가: s.frame(Event::Terminal(Terminal { | |
| 931 | 추가: outcome: Outcome::Completed, | |
| 932 | 추가: error: None, | |
| 933 | 추가: publication: Publication::Complete, | |
| 934 | 추가: created_count: 1, | |
| 935 | 추가: retained_partial_count: 0, | |
| 936 | 추가: durability: Durability::Synced, | |
| 937 | 추가: cleanup: Cleanup::Complete, | |
| 938 | 추가: })); | |
| 939 | 추가: } | |
| 940 | 추가: m.poll(); | |
| 941 | 추가: assert!(!m.confirmed); | |
| 942 | 추가: f.state.borrow_mut().queue.push_back(HostEvent::StdoutEof); | |
| 943 | 추가: m.poll(); | |
| 944 | 추가: assert!(!m.confirmed); | |
| 945 | 추가: f.state.borrow_mut().queue.push_back(HostEvent::StderrEof); | |
| 946 | 추가: m.poll(); | |
| 947 | 추가: assert!(!m.confirmed); | |
| 948 | 추가: f.state | |
| 949 | 추가: .borrow_mut() | |
| 950 | 추가: .queue | |
| 951 | 추가: .push_back(HostEvent::Exited { success: true }); | |
| 952 | 추가: pump(&mut m); | |
| 953 | 추가: assert!(m.confirmed); | |
| 954 | 추가: assert!(m.error.is_none()); | |
| 955 | 추가: } |
| @@ -140,6 +140,12 @@ fn every_listed_scenario_draws_and_keeps_its_expected_screen() { | ||
| 140 | 140 | "extract-unsynced" => "파일을 디스크에 완전히 저장했는지 확인하지 못했습니다", |
| 141 | 141 | "source-changed" => "압축파일 다시 열기", |
| 142 | 142 | "gzip-conflict" => "다른 이름으로 저장", |
| 143 | 추가: "create-sevenzip" => "7z는 암호를 지원하지 않습니다", | |
| 144 | 추가: "create-sevenzip-progress" => "파일을 저장하는 중", | |
| 145 | 추가: "create-sevenzip-complete" => "7z 파일을 만들었습니다", | |
| 146 | 추가: "create-sevenzip-error" => "7z 파일을 만들지 못했습니다", | |
| 147 | 추가: "create-sevenzip-cancelled" => "작업을 취소했습니다", | |
| 148 | 추가: "create-sevenzip-resource" => "큰 작업을 허용할까요?", | |
| 143 | 149 | "create-error" => "ZIP 파일을 만들지 못했습니다", |
| 144 | 150 | "password-create" => "암호 확인", |
| 145 | 151 | "folder" => "바다.jpg", |
| @@ -21,6 +21,13 @@ macro_rules! catalog { | ||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | catalog! { |
| 24 | 추가: "create-sevenzip" => "7z 형식 선택과 LZMA2 및 암호 미지원 안내", | |
| 25 | 추가: "create-sevenzip-progress" => "7z 만들기 진행과 취소", | |
| 26 | 추가: "create-sevenzip-complete" => "7z 만들기 완료", | |
| 27 | 추가: "create-sevenzip-error" => "7z 만들기 저장 실패", | |
| 28 | 추가: "create-sevenzip-cancelled" => "7z 만들기 취소 완료", | |
| 29 | 추가: "create-sevenzip-resource" => "7z 만들기의 큰 작업 승인", | |
| 30 | 추가: | |
| 24 | 31 | "split-archive" => "분할 7z 목록과 미리보기 비활성화", |
| 25 | 32 | "split-first-volume" => "첫 조각의 정확한 파일명 안내", |
| 26 | 33 | "split-missing-volume" => "누락 조각 파일명과 재시도 안내", |
| @@ -511,7 +518,7 @@ impl Scenario { | ||
| 511 | 518 | } |
| 512 | 519 | return app; |
| 513 | 520 | } |
| 514 | 삭제: "create" | "create-encrypted" => { | |
| 521 | 추가: "create" | "create-encrypted" | "create-sevenzip" => { | |
| 515 | 522 | app.sources = vec![base.join("읽어주세요.txt"), base.join("사진")]; |
| 516 | 523 | app.scenario_sources = Some(std::rc::Rc::new(vec![ |
| 517 | 524 | SourceRow { |
| @@ -526,10 +533,12 @@ impl Scenario { | ||
| 526 | 533 | }, |
| 527 | 534 | ])); |
| 528 | 535 | app.show_create(self.name == "create-encrypted"); |
| 536 | 추가: app.set_seven_zip(self.name == "create-sevenzip"); | |
| 529 | 537 | return app; |
| 530 | 538 | } |
| 531 | 539 | _ => {} |
| 532 | 540 | } |
| 541 | 추가: let seven_zip = self.name.starts_with("create-sevenzip"); | |
| 533 | 542 | let creating = self.name.starts_with("create-") || self.name == "password-create"; |
| 534 | 543 | let listing_error = matches!(self.name, "unsupported" | "damaged"); |
| 535 | 544 | if matches!(self.name, "gzip-conflict" | "gzip-conflict-choice") { |
| @@ -544,7 +553,12 @@ impl Scenario { | ||
| 544 | 553 | }]; |
| 545 | 554 | app.gzip_name = "여행 자료".into(); |
| 546 | 555 | } |
| 547 | 삭제: let request = if creating { | |
| 556 | 추가: let request = if seven_zip { | |
| 557 | 추가: Start::CreateSevenZip { | |
| 558 | 추가: sources: vec![(base.join("사진"), "사진".into())], | |
| 559 | 추가: output_file: base.join("여행 자료.7z"), | |
| 560 | 추가: } | |
| 561 | 추가: } else if creating { | |
| 548 | 562 | Start::CreateZip { |
| 549 | 563 | sources: vec![(base.join("사진"), "사진".into())], |
| 550 | 564 | output_file: base.join("여행 자료.zip"), |
| @@ -564,7 +578,12 @@ impl Scenario { | ||
| 564 | 578 | } |
| 565 | 579 | }; |
| 566 | 580 | app.targets = Some(if creating { |
| 567 | 삭제: BTreeSet::from(["여행 자료.zip".into()]) | |
| 581 | 추가: BTreeSet::from([if seven_zip { | |
| 582 | 추가: "여행 자료.7z" | |
| 583 | 추가: } else { | |
| 584 | 추가: "여행 자료.zip" | |
| 585 | 추가: } | |
| 586 | 추가: .into()]) | |
| 568 | 587 | } else if matches!(self.name, "gzip-conflict" | "gzip-conflict-choice") { |
| 569 | 588 | BTreeSet::from(["여행 자료".into()]) |
| 570 | 589 | } else { |
| @@ -588,13 +607,19 @@ impl Scenario { | ||
| 588 | 607 | assert!(app.start(request)); |
| 589 | 608 | { |
| 590 | 609 | let mut state = state.borrow_mut(); |
| 591 | 삭제: state.frame(Event::Accepted { encryption: true }); | |
| 610 | 추가: state.frame(Event::Accepted { | |
| 611 | 추가: encryption: !seven_zip, | |
| 612 | 추가: }); | |
| 592 | 613 | match self.name { |
| 593 | 삭제: "resource-approval" | "resource-ratio" => { | |
| 594 | 삭제: let expanded = self.name == "resource-approval"; | |
| 614 | 추가: "resource-approval" | "resource-ratio" | "create-sevenzip-resource" => { | |
| 615 | 추가: let expanded = self.name != "resource-ratio"; | |
| 595 | 616 | state.frame(Event::ResourceRequired(ResourceChallenge { |
| 596 | 617 | id: 1, |
| 597 | 삭제: action: ActionKind::Extract, | |
| 618 | 추가: action: if seven_zip { | |
| 619 | 추가: ActionKind::CreateSevenZip | |
| 620 | 추가: } else { | |
| 621 | 추가: ActionKind::Extract | |
| 622 | 추가: }, | |
| 598 | 623 | scope: ResourceScope { |
| 599 | 624 | output: expanded, |
| 600 | 625 | entries: expanded, |
| @@ -723,7 +748,10 @@ impl Scenario { | ||
| 723 | 748 | encrypt: self.name == "password-create", |
| 724 | 749 | }) |
| 725 | 750 | } |
| 726 | 삭제: "extract-complete" | "create-complete" | "extract-unsynced" => { | |
| 751 | 추가: "extract-complete" | |
| 752 | 추가: | "create-complete" | |
| 753 | 추가: | "create-sevenzip-complete" | |
| 754 | 추가: | "extract-unsynced" => { | |
| 727 | 755 | let names = app.targets.as_ref().unwrap(); |
| 728 | 756 | for name in names { |
| 729 | 757 | state.frame(Event::Output { |
| @@ -751,7 +779,9 @@ impl Scenario { | ||
| 751 | 779 | HostEvent::Exited { success: true }, |
| 752 | 780 | ]); |
| 753 | 781 | } |
| 754 | 삭제: "extract-cancelled" => state.finish(Outcome::Cancelled, Publication::None), | |
| 782 | 추가: "extract-cancelled" | "create-sevenzip-cancelled" => { | |
| 783 | 추가: state.finish(Outcome::Cancelled, Publication::None) | |
| 784 | 추가: } | |
| 755 | 785 | "extract-partial" | "extract-uncertain" => { |
| 756 | 786 | let partial = self.name == "extract-partial"; |
| 757 | 787 | if partial { |
| @@ -780,14 +810,19 @@ impl Scenario { | ||
| 780 | 810 | HostEvent::Exited { success: true }, |
| 781 | 811 | ]); |
| 782 | 812 | } |
| 783 | 삭제: "conflict" | "gzip-conflict" | "unsupported" | "damaged" | "source-changed" | |
| 784 | 삭제: | "create-error" => { | |
| 813 | 추가: "conflict" | |
| 814 | 추가: | "gzip-conflict" | |
| 815 | 추가: | "unsupported" | |
| 816 | 추가: | "damaged" | |
| 817 | 추가: | "source-changed" | |
| 818 | 추가: | "create-error" | |
| 819 | 추가: | "create-sevenzip-error" => { | |
| 785 | 820 | state.frame(Event::Terminal(Terminal { |
| 786 | 821 | outcome: Outcome::Failed, |
| 787 | 822 | error: Some(match self.name { |
| 788 | 823 | "conflict" | "gzip-conflict" => ErrorCode::Conflict, |
| 789 | 824 | "source-changed" => ErrorCode::SourceChanged, |
| 790 | 삭제: "create-error" => ErrorCode::DiskFull, | |
| 825 | 추가: "create-error" | "create-sevenzip-error" => ErrorCode::DiskFull, | |
| 791 | 826 | "unsupported" => ErrorCode::UnsupportedFormat, |
| 792 | 827 | _ => ErrorCode::Integrity, |
| 793 | 828 | }), |