Add --temp-directory argument to set temp directory.

This commit is contained in:
comfyanonymous
2023-08-11 05:00:25 -04:00
parent 00877b0363
commit 2bc12d3d22
3 changed files with 10 additions and 1 deletions

View File

@@ -100,7 +100,7 @@ def hijack_progress(server):
def cleanup_temp():
temp_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "temp")
temp_dir = folder_paths.get_temp_directory()
if os.path.exists(temp_dir):
shutil.rmtree(temp_dir, ignore_errors=True)
@@ -127,6 +127,10 @@ def load_extra_path_config(yaml_path):
if __name__ == "__main__":
if args.temp_directory:
temp_dir = os.path.join(os.path.abspath(args.temp_directory), "temp")
print(f"Setting temp directory to: {temp_dir}")
folder_paths.set_temp_directory(temp_dir)
cleanup_temp()
loop = asyncio.new_event_loop()