mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 15:14:41 +00:00
Correct UnixSetFileAccess to allow chmoding a directory
This commit is contained in:
parent
ee3a9cf6fd
commit
7930a652dd
1 changed files with 7 additions and 1 deletions
|
@ -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()));
|
||||
|
|
Loading…
Reference in a new issue