2
0

GlobalBase static is FileInUse

This commit is contained in:
Glax 2024-02-28 02:13:53 +01:00
parent e2adac937a
commit a8697a14a3

View File

@ -102,7 +102,9 @@ public abstract class GlobalBase
File.WriteAllText(settings.libraryConnectorsFilePath, JsonConvert.SerializeObject(libraryConnectors)); File.WriteAllText(settings.libraryConnectorsFilePath, JsonConvert.SerializeObject(libraryConnectors));
} }
protected bool IsFileInUse(string filePath) protected bool IsFileInUse(string filePath) => IsFileInUse(filePath, this.logger);
public static bool IsFileInUse(string filePath, Logger? logger)
{ {
if (!File.Exists(filePath)) if (!File.Exists(filePath))
return false; return false;
@ -114,7 +116,7 @@ public abstract class GlobalBase
} }
catch (IOException) catch (IOException)
{ {
Log($"File is in use {filePath}"); logger?.WriteLine($"File is in use {filePath}");
return true; return true;
} }
} }