Skip to content

Commit

Permalink
Fix startup when PEDALBOARD_TMP_DIR exists but FS is read-only
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Jan 28, 2024
1 parent 27508b3 commit 9e769f8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mod/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ def check_environment():
# create temp dirs
if not os.path.exists(DOWNLOAD_TMP_DIR):
os.makedirs(DOWNLOAD_TMP_DIR)

if os.path.exists(PEDALBOARD_TMP_DIR):
shutil.rmtree(PEDALBOARD_TMP_DIR)
os.makedirs(PEDALBOARD_TMP_DIR)
try:
shutil.rmtree(PEDALBOARD_TMP_DIR)
except OSError:
pass
else:
os.makedirs(PEDALBOARD_TMP_DIR)

# remove temp files
for path in (CAPTURE_PATH, PLAYBACK_PATH, UPDATE_CC_FIRMWARE_FILE):
Expand Down Expand Up @@ -105,7 +110,7 @@ def check_environment():

if os.path.exists(UPDATE_MOD_OS_HERLPER_FILE):
os.remove(UPDATE_MOD_OS_HERLPER_FILE)
os.sync()
os_sync()

return True

Expand Down

0 comments on commit 9e769f8

Please sign in to comment.