From 7038140c7ec8d312a704eb17dc75a9763685f143 Mon Sep 17 00:00:00 2001 From: Wouter Wijsman Date: Sat, 9 Jan 2016 21:21:54 +0100 Subject: [PATCH 1/2] Fixed backup directory not being created --- ice/configuration.py | 11 ++++++++--- ice/runners/ice_engine.py | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ice/configuration.py b/ice/configuration.py index 5749731..629388f 100644 --- a/ice/configuration.py +++ b/ice/configuration.py @@ -144,7 +144,7 @@ def set_userdata_directory(self, dir): ) self.config_backing_store.save() - def shortcuts_backup_path(self, user, timestamp_format="%Y%m%d%H%M%S"): + def shortcuts_backup_path(self, user, filesystem, timestamp_format="%Y%m%d%H%M%S"): """ Returns the path for a shortcuts.vdf backup file. @@ -157,10 +157,15 @@ def shortcuts_backup_path(self, user, timestamp_format="%Y%m%d%H%M%S"): timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S') filename = "shortcuts." + timestamp + ".vdf" - return os.path.join( + dirname = ( backup_dir, str(user.user_id), - 'config', + 'config' + ) + if filesystem.path_exists(dirname) == False: + filesystem.create_directories(dirname) + return os.path.join( + dirname, filename ) diff --git a/ice/runners/ice_engine.py b/ice/runners/ice_engine.py index 3ba73c8..2ce7110 100644 --- a/ice/runners/ice_engine.py +++ b/ice/runners/ice_engine.py @@ -159,7 +159,7 @@ def _create_backup(self, user, dry_run=False): self.logger.debug("Not creating backup because its a dry run") return - backup_path = self.config.shortcuts_backup_path(user) + backup_path = self.config.shortcuts_backup_path(user, self.filesystem) if backup_path is None: self.logger.info("No backups directory specified, so not backing up shortcuts.vdf before overwriting. See config.txt for more info") return From 226735f20a47f5febf10ac167119a4080df86317 Mon Sep 17 00:00:00 2001 From: Wouter Wijsman Date: Wed, 13 Jan 2016 20:29:32 +0100 Subject: [PATCH 2/2] Ignore anonymous user This user is found on SteamOS, but can't be used. Shortcuts are created, but will never be used by a user. --- ice/runners/ice_engine.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ice/runners/ice_engine.py b/ice/runners/ice_engine.py index 2ce7110..bd7fb66 100644 --- a/ice/runners/ice_engine.py +++ b/ice/runners/ice_engine.py @@ -129,6 +129,8 @@ def main(self, dry_run=False): # TODO: Create any missing directories that Ice will need log_configuration(self.logger, self.config) for user_context in steam.local_user_contexts(self.steam): + if user_context.user_id == "anonymous": + continue self.logger.info("=========== User: %s ===========" % str(user_context.user_id)) self.run_for_user(user_context, dry_run=dry_run)