mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 22:20:52 +00:00
Also chmod the directory for CrossProcessFileBasedSemaphore
This commit is contained in:
@@ -153,14 +153,34 @@ namespace ArchiSteamFarm.Helpers {
|
||||
}
|
||||
|
||||
private void EnsureFileExists() {
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(FilePath));
|
||||
|
||||
FileInfo fileInfo = new FileInfo(FilePath);
|
||||
|
||||
if (fileInfo.Exists) {
|
||||
return;
|
||||
}
|
||||
|
||||
string directoryPath = Path.GetDirectoryName(FilePath);
|
||||
|
||||
if (string.IsNullOrEmpty(directoryPath)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(directoryPath));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
DirectoryInfo directoryInfo = new DirectoryInfo(directoryPath);
|
||||
|
||||
if (!directoryInfo.Exists) {
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
|
||||
if (OS.IsUnix) {
|
||||
OS.UnixSetFileAccess(directoryPath, OS.EUnixPermission.Combined777);
|
||||
} else {
|
||||
DirectorySecurity directorySecurity = new DirectorySecurity(FilePath, AccessControlSections.All);
|
||||
|
||||
directoryInfo.SetAccessControl(directorySecurity);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
using (new FileStream(FilePath, FileMode.CreateNew)) { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user