[App] Remove possible leftover temporary files.

This commit is contained in:
2025-07-29 21:38:57 +01:00
parent cb4511c09d
commit b68f6f792f
2 changed files with 12 additions and 4 deletions

View File

@@ -334,11 +334,15 @@ public partial class ImportRoms : ComponentBase
KnownOnlyChecked, KnownOnlyChecked,
RemoveFilesChecked); RemoveFilesChecked);
string tmpFile = Path.Combine(Settings.Settings.Current.RepositoryPath,
Path.GetRandomFileName());
worker.ImportAndHashRom(reader.OpenEntryStream(), worker.ImportAndHashRom(reader.OpenEntryStream(),
reader.Entry.Key, reader.Entry.Key,
Path.Combine(Settings.Settings.Current.RepositoryPath, tmpFile,
Path.GetFileName(Path.GetTempFileName())),
reader.Entry.Size); reader.Entry.Size);
if(File.Exists(tmpFile)) File.Delete(tmpFile);
} }
} }
catch(InvalidOperationException) {} catch(InvalidOperationException) {}

View File

@@ -432,11 +432,15 @@ public sealed partial class ImportRomFolderViewModel : ViewModelBase
Dispatcher.UIThread.Post(() => Importers.Add(model)); Dispatcher.UIThread.Post(() => Importers.Add(model));
string tmpFile = Path.Combine(Settings.Settings.Current.RepositoryPath,
Path.GetRandomFileName());
worker.ImportAndHashRom(reader.OpenEntryStream(), worker.ImportAndHashRom(reader.OpenEntryStream(),
reader.Entry.Key, reader.Entry.Key,
Path.Combine(Settings.Settings.Current.RepositoryPath, tmpFile,
Path.GetFileName(Path.GetTempFileName())),
reader.Entry.Size); reader.Entry.Size);
if(File.Exists(tmpFile)) File.Delete(tmpFile);
} }
} }
catch(InvalidOperationException) {} catch(InvalidOperationException) {}