Skip to content

Commit

Permalink
Merge pull request #1103 from shananas/Fix-Patching
Browse files Browse the repository at this point in the history
Check if File.Exists before trying to move it preventing a crash.
  • Loading branch information
Delta-473 authored Aug 28, 2024
2 parents c40eebe + 19cb486 commit 6e7c90d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions OpenKh.Tools.ModsManager/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,11 @@ await Task.Run(() =>
{
var sourceFile = Path.Combine(ConfigurationService.GameModPath, _launchGame, entry.Key);
var destFile = Path.Combine(patchStagingDir, entry.Value);
Directory.CreateDirectory(Path.GetDirectoryName(destFile));
File.Move(sourceFile, destFile);
if (File.Exists(sourceFile))
{
Directory.CreateDirectory(Path.GetDirectoryName(destFile));
File.Move(sourceFile, destFile);
}
}

foreach (var directory in Directory.GetDirectories(Path.Combine(ConfigurationService.GameModPath, _launchGame)))
Expand Down

0 comments on commit 6e7c90d

Please sign in to comment.