mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
safer delete versions
This commit is contained in:
parent
0bfb3c3dfc
commit
06502b1006
2 changed files with 8 additions and 2 deletions
|
|
@ -492,7 +492,8 @@ class DeleteOldVersions(BaseAction):
|
|||
os.remove(file_path)
|
||||
self.log.debug("Removed file: {}".format(file_path))
|
||||
|
||||
remainders.remove(file_path_base)
|
||||
if file_path_base in remainders:
|
||||
remainders.remove(file_path_base)
|
||||
continue
|
||||
|
||||
seq_path_base = os.path.split(seq_path)[1]
|
||||
|
|
|
|||
|
|
@ -126,7 +126,8 @@ class DeleteOldVersions(load.SubsetLoaderPlugin):
|
|||
os.remove(file_path)
|
||||
self.log.debug("Removed file: {}".format(file_path))
|
||||
|
||||
remainders.remove(file_path_base)
|
||||
if file_path_base in remainders:
|
||||
remainders.remove(file_path_base)
|
||||
continue
|
||||
|
||||
seq_path_base = os.path.split(seq_path)[1]
|
||||
|
|
@ -333,6 +334,8 @@ class DeleteOldVersions(load.SubsetLoaderPlugin):
|
|||
def main(self, data, remove_publish_folder):
|
||||
# Size of files.
|
||||
size = 0
|
||||
if not data:
|
||||
return size
|
||||
|
||||
if remove_publish_folder:
|
||||
size = self.delete_whole_dir_paths(data["dir_paths"].values())
|
||||
|
|
@ -418,6 +421,8 @@ class DeleteOldVersions(load.SubsetLoaderPlugin):
|
|||
)
|
||||
|
||||
data = self.get_data(context, versions_to_keep)
|
||||
if not data:
|
||||
continue
|
||||
|
||||
size += self.main(data, remove_publish_folder)
|
||||
print("Progressing {}/{}".format(count + 1, len(contexts)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue