Skip to content

Commit

Permalink
Added check to make the trash directory if the users is moving a file…
Browse files Browse the repository at this point in the history
… object to trash and the trash directory is missing.
  • Loading branch information
BryanRumsey committed May 31, 2021
1 parent 6f02544 commit 0931777
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions stochss/handlers/util/stochss_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def get_new_path(self, dst_path):
New path for the file object from the users home directory
'''
new_path = os.path.join(self.user_dir, dst_path)
if dst_path.startswith("trash/") and not "trash" in os.listdir(self.user_dir):
os.mkdir(os.path.join(self.user_dir, "trash"))
if new_path.split().pop().replace('.', '', 5).isdigit():
return new_path.replace(new_path.split().pop(), "").strip()
if "trash/" in new_path and os.path.exists(new_path):
Expand Down

0 comments on commit 0931777

Please sign in to comment.