finally fucking fixed RenameFileWithInvalidChars

This commit is contained in:
Bitl 2021-09-25 13:55:04 -07:00
parent cc6b807c3d
commit f1324f3de9
1 changed files with 16 additions and 7 deletions

View File

@ -1900,6 +1900,8 @@ public class GlobalFuncs
} }
public static void RenameFileWithInvalidChars(string path) public static void RenameFileWithInvalidChars(string path)
{
try
{ {
if (!FileHasInvalidChars(path)) if (!FileHasInvalidChars(path))
return; return;
@ -1909,7 +1911,14 @@ public class GlobalFuncs
fileName = Regex.Replace(fileName, @"[^\w-.'_!()& ]", ""); fileName = Regex.Replace(fileName, @"[^\w-.'_!()& ]", "");
string finalPath = pathWithoutFilename + "\\" + fileName; string finalPath = pathWithoutFilename + "\\" + fileName;
FixedFileMove(path, finalPath, false); FixedFileMove(path, finalPath, File.Exists(finalPath));
}
catch (Exception ex)
{
#if LAUNCHER || CMD || URI
LogExceptions(ex);
#endif
}
} }
#if LAUNCHER || CMD || URI #if LAUNCHER || CMD || URI