mirror of
https://github.com/nims11/IPod-Shuffle-4g.git
synced 2025-12-07 16:08:00 +09:00
directory permission check, non zero return status
This commit is contained in:
parent
344b227c2b
commit
395dd59718
1 changed files with 10 additions and 3 deletions
13
shuffle.py
13
shuffle.py
|
|
@ -547,6 +547,15 @@ def nonnegative_int(string):
|
|||
raise argparse.ArgumentTypeError("Track gain value should be in range 0-99")
|
||||
return intval
|
||||
|
||||
def checkPathValidity(path):
|
||||
if not os.path.isdir(result.path):
|
||||
print "Error finding IPod directory. Maybe it is not connected or mounted?"
|
||||
sys.exit(1)
|
||||
|
||||
if not os.access(result.path, os.W_OK):
|
||||
print 'Unable to get write permissions in the IPod directory'
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--disable-voiceover', action='store_true', help='Disable Voiceover Feature')
|
||||
|
|
@ -555,9 +564,7 @@ if __name__ == '__main__':
|
|||
parser.add_argument('path')
|
||||
result = parser.parse_args()
|
||||
|
||||
if not os.path.isdir(result.path):
|
||||
print "Error finding IPod directory. Maybe it is not connected or mounted?"
|
||||
sys.exit()
|
||||
checkPathValidity(result.path)
|
||||
|
||||
if result.rename_unicode:
|
||||
check_unicode(result.path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue