mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
Correct UnixSetFileAccess to allow chmoding a directory
This commit is contained in:
@@ -138,7 +138,7 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
internal static void UnixSetFileAccess(string path, EUnixPermission permission) {
|
||||
if (string.IsNullOrEmpty(path) || !File.Exists(path)) {
|
||||
if (string.IsNullOrEmpty(path)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(path));
|
||||
|
||||
return;
|
||||
@@ -148,6 +148,12 @@ namespace ArchiSteamFarm {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!File.Exists(path) && !Directory.Exists(path)) {
|
||||
ASF.ArchiLogger.LogGenericError(string.Format(Strings.WarningFailedWithError, "!" + nameof(path)));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Chmod() returns 0 on success, -1 on failure
|
||||
if (NativeMethods.Chmod(path, (int) permission) != 0) {
|
||||
ASF.ArchiLogger.LogGenericError(string.Format(Strings.WarningFailedWithError, Marshal.GetLastWin32Error()));
|
||||
|
||||
Reference in New Issue
Block a user