Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed backup directory not being created #334

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ice/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
)

Expand Down
4 changes: 3 additions & 1 deletion ice/runners/ice_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -159,7 +161,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
Expand Down