Skip to content

Commit

Permalink
fixed improper purge storage
Browse files Browse the repository at this point in the history
  • Loading branch information
Bikatr7 committed Mar 21, 2024
1 parent f6c1d8c commit 606d770
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions modules/common/file_ensurer.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ def purge_storage() -> None:
FileEnsurer.archive_dir
]

stuff_to_truncate = [
FileEnsurer.output_dir
]

for thing in stuff_to_purge:
if(os.path.exists(thing)):

Expand All @@ -241,6 +245,18 @@ def purge_storage() -> None:
else:
os.remove(thing)

for thing in stuff_to_truncate:
if(os.path.exists(thing)):
if(os.path.isdir(thing)):
for file in os.listdir(thing):
file_path = os.path.join(thing, file)
if(os.path.isfile(file_path)):
with open(file_path, "w", encoding="utf-8") as file:
file.truncate()

else:
with open(thing, "w", encoding="utf-8") as file:
file.truncate()
##--------------------start-of-standard_create_directory()------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

@staticmethod
Expand Down

0 comments on commit 606d770

Please sign in to comment.