Use Path.DirectorySeparatorChar

save-path-regex
Pat Hartl 2023-11-30 18:31:05 -06:00
parent 74d8790ee2
commit 7b625b2f60
1 changed files with 2 additions and 2 deletions

View File

@ -67,7 +67,7 @@ namespace LANCommander.SDK
bool inInstallDir = savePath.Path.StartsWith("{InstallDir}"); bool inInstallDir = savePath.Path.StartsWith("{InstallDir}");
string tempSavePath = Path.Combine(tempLocation, savePath.Id.ToString()); string tempSavePath = Path.Combine(tempLocation, savePath.Id.ToString());
var tempSavePathFile = Path.Combine(tempSavePath, savePath.Path.Replace('/', Path.DirectorySeparatorChar).Replace("{InstallDir}\\", "")); var tempSavePathFile = Path.Combine(tempSavePath, savePath.Path.Replace('/', Path.DirectorySeparatorChar).Replace("{InstallDir}" + Path.DirectorySeparatorChar, ""));
destination = Environment.ExpandEnvironmentVariables(savePath.Path.Replace('/', Path.DirectorySeparatorChar).Replace("{InstallDir}", installDirectory)); destination = Environment.ExpandEnvironmentVariables(savePath.Path.Replace('/', Path.DirectorySeparatorChar).Replace("{InstallDir}", installDirectory));
@ -98,7 +98,7 @@ namespace LANCommander.SDK
else else
{ {
// Specified path is probably an absolute path, maybe with environment variables. // Specified path is probably an absolute path, maybe with environment variables.
destination = Environment.ExpandEnvironmentVariables(file.Replace(tempSavePathFile, savePath.Path.Replace('/', '\\'))); destination = Environment.ExpandEnvironmentVariables(file.Replace(tempSavePathFile, savePath.Path.Replace('/', Path.DirectorySeparatorChar)));
if (File.Exists(destination)) if (File.Exists(destination))
File.Delete(destination); File.Delete(destination);