Skip to content

Commit

Permalink
fixed check for files
Browse files Browse the repository at this point in the history
  • Loading branch information
EnyMan committed Jun 25, 2016
1 parent 60e1a50 commit 7fcfa43
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions imgmanip.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,22 +165,21 @@ def check_if_files(args, mode="RW"):
:param args: files to check
:returns: string of bad files separated by space
"""

read = write = True
broken = ""
for file in args:
for perm in mode:
if perm == "R":
if not os.path.exists(file) and not os.access(file, os.R_OK):
if broken == "":
broken += file
else:
broken += " " + file
read = False
if perm == "W":
if not os.path.exists(file) and not os.access(file, os.W_OK):
if broken == "":
broken += file
else:
broken += " " + file
write = False
if not read or not write:
if broken == "":
broken += file
else:
broken += " " + file

return broken

Expand Down

0 comments on commit 7fcfa43

Please sign in to comment.