Skip to content

Commit

Permalink
Merge pull request #4364 from OpenShot/protect-recovery-process
Browse files Browse the repository at this point in the history
Protect recovery process from missing project file
  • Loading branch information
jonoomph authored Aug 27, 2021
2 parents c42d2f5 + f83109d commit e87734d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/classes/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def get_assets_path(file_path=None, create_paths=True):
if create_paths:
if not os.path.exists(asset_path):
if os.path.exists(asset_path_30_char):
#copy assets folder, if it follows the previous naming convention
#must leave a copy for possible projects that shared the folder.
# Copy assets folder, if it follows the previous naming convention
# must leave a copy for possible projects that shared the folder.
try:
shutil.copytree(asset_path_30_char, asset_path)
log.info("Copying shortened asset folder. {}".format(asset_path))
Expand All @@ -64,7 +64,7 @@ def get_assets_path(file_path=None, create_paths=True):
os.mkdir(asset_path)
log.info("Asset dir created as {}".format(asset_path))
else:
log.info("Using existing asset folder {}".format(asset_path))
log.debug("Using existing asset folder {}".format(asset_path))

# Create asset thumbnails folder
asset_thumbnails_folder = os.path.join(asset_path, "thumbnail")
Expand Down
2 changes: 1 addition & 1 deletion src/classes/thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def log_message(self, msg_format, *args):

def log_error(self, msg_format, *args):
""" Log error from HTTPServer """
log.error(msg_format % args)
log.warning(msg_format % args)

def do_GET(self):
""" Process each GET request and return a value (image or file path)"""
Expand Down
5 changes: 4 additions & 1 deletion src/windows/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,10 @@ def auto_save_project(self):
# Make copy of unsaved project file in 'recovery' folder
recover_path_with_timestamp = os.path.join(
info.RECOVERY_PATH, "%d-%s.osp" % (int(time.time()), file_name))
shutil.copy(file_path, recover_path_with_timestamp)
if os.path.exists(file_path):
shutil.copy(file_path, recover_path_with_timestamp)
else:
log.warning("Existing project *.osp file not found during recovery process: %s" % file_path)

# Find any recovery file older than X auto-saves
old_backup_files = []
Expand Down

0 comments on commit e87734d

Please sign in to comment.