GlobalBase static is FileInUse
This commit is contained in:
parent
e2adac937a
commit
a8697a14a3
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user