[game-data-packager] 02/02: core: check that all --destination & --save-downloads are writable

Alexandre Detiste detiste-guest at moszumanska.debian.org
Fri Sep 18 08:11:17 UTC 2015


This is an automated email from the git hooks/post-receive script.

detiste-guest pushed a commit to branch master
in repository game-data-packager.

commit dbe046949ab0cc39829d15a967f3f8f24a54eca9
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Fri Sep 18 10:10:40 2015 +0200

    core: check that all --destination & --save-downloads are writable
---
 game_data_packager/__init__.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index 4127cfa..2948b5f 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -3468,11 +3468,16 @@ def run_command_line():
         parser.print_help()
         sys.exit(0)
 
-    if (parsed.save_downloads is not None and
-            not os.path.isdir(parsed.save_downloads)):
-        logger.error('argument "%s" to --save-downloads does not exist',
-                parsed.save_downloads)
-        sys.exit(2)
+    for arg, path in (('--save-downloads', parsed.save_downloads),
+                      ('--destination', parsed.destination)):
+        if path is None:
+            continue
+        elif not os.path.isdir(path):
+            logger.error('argument "%s" to %s does not exist', path, arg)
+            sys.exit(2)
+        elif not os.access(path, os.W_OK | os.X_OK):
+            logger.error('argument "%s" to %s is not writable', path, arg)
+            sys.exit(2)
 
     if parsed.shortname == 'steam':
         run_steam_meta_mode(parsed, games)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list