Fixed an issue where in case of name conflict, the compressed game would add a number suffix after the extension "MKWF v0.12.wbfs (1)" instead of "MKWF v0.12 (1).wbfs"

This commit is contained in:
Faraphel 2022-08-13 22:49:04 +02:00
parent 71229d2e2e
commit 922669fdaf

View file

@ -162,12 +162,12 @@ class ExtractedGame:
if output_type == wit.Extension.FST: return if output_type == wit.Extension.FST: return
destination_file = self.path.with_suffix(self.path.suffix + output_type.value) destination_file = self.path.with_suffix(self.path.suffix + output_type.value)
dest_name: str = destination_file.name dest_stem: str = destination_file.stem
i: int = 0 i: int = 0
while destination_file.exists(): while destination_file.exists():
i += 1 i += 1
destination_file = destination_file.with_name(dest_name + f" ({i})") destination_file = destination_file.with_stem(dest_stem + f" ({i})")
converted_game: wit.WITPath = wit.copy( converted_game: wit.WITPath = wit.copy(
source_directory=self.path, source_directory=self.path,