diff --git a/src/ui/gui.py b/src/ui/gui.py index 5b336cc..5bf3ddd 100644 --- a/src/ui/gui.py +++ b/src/ui/gui.py @@ -197,15 +197,16 @@ class BatchTableExtractorApp: filetypes=[("Word 文档", "*.doc *.docx"), ("所有文件", "*.*")] ) if path: + path = os.path.normpath(path) self.src_path_var.set(path) if not self.out_dir_var.get().strip(): base_dir = path if self.mode_var.get() == "dir" else os.path.dirname(path) - self.out_dir_var.set(os.path.join(base_dir, "convert")) + self.out_dir_var.set(os.path.normpath(os.path.join(base_dir, "convert"))) def _browse_out(self): path = filedialog.askdirectory(title="选择输出目录") if path: - self.out_dir_var.set(path) + self.out_dir_var.set(os.path.normpath(path)) def _on_drop_files(self, files): if not files: @@ -231,15 +232,15 @@ class BatchTableExtractorApp: if os.path.isdir(first_path): self.mode_var.set("dir") self._on_mode_change() - self.src_path_var.set(first_path) + self.src_path_var.set(os.path.normpath(first_path)) if not self.out_dir_var.get().strip(): - self.out_dir_var.set(os.path.join(first_path, "convert")) + self.out_dir_var.set(os.path.normpath(os.path.join(first_path, "convert"))) elif os.path.isfile(first_path): self.mode_var.set("file") self._on_mode_change() - self.src_path_var.set(first_path) + self.src_path_var.set(os.path.normpath(first_path)) if not self.out_dir_var.get().strip(): - self.out_dir_var.set(os.path.join(os.path.dirname(first_path), "convert")) + self.out_dir_var.set(os.path.normpath(os.path.join(os.path.dirname(first_path), "convert"))) if self.auto_extract_var.get(): self.root.after(100, self._start)