Skip to content

Commit

Permalink
Fix check_perms
Browse files Browse the repository at this point in the history
  • Loading branch information
Setsugennoao committed Jun 24, 2024
1 parent c91a97b commit 3be53c2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions stgpytools/utils/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,20 @@ def check_perms(
while not check_file.exists():
check_file = check_file.parent

if strict and file.is_dir():
raise FileIsADirectoryError(file, func)

got_perms = access(check_file, mode_i)

if func is not None:
if not got_perms:
raise FilePermissionError(file, func)

if strict:
if file.is_dir():
raise FileIsADirectoryError(file, func)
elif not file.exists():
if strict and not file.exists():
if file.parent.exists():
raise FileWasNotFoundError(file, func)
else:
raise FileNotExistsError(file, func)

raise FileNotExistsError(file, func)

raise FilePermissionError(file, func)

return got_perms

Expand Down

0 comments on commit 3be53c2

Please sign in to comment.