Skip to content

Commit c1909f3

Browse files
authored
Better argument handling of front-end-root (#7043)
* Better argument handling of front-end-root Improves handling of front-end-root launch argument. Several instances where users have set it and ComfyUI launches as normal and completely disregards the launch arg which doesn't make sense. Better to indicate to user that something is incorrect. * Removed unused import There was no real reason to use "Optional" typing in ther front-end-root argument.
1 parent 52b3469 commit c1909f3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

comfy/cli_args.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import argparse
22
import enum
33
import os
4-
from typing import Optional
54
import comfy.options
65

76

@@ -166,13 +165,14 @@ class PerformanceFeature(enum.Enum):
166165
""",
167166
)
168167

169-
def is_valid_directory(path: Optional[str]) -> Optional[str]:
170-
"""Validate if the given path is a directory."""
171-
if path is None:
172-
return None
173-
168+
def is_valid_directory(path: str) -> str:
169+
"""Validate if the given path is a directory, and check permissions."""
170+
if not os.path.exists(path):
171+
raise argparse.ArgumentTypeError(f"The path '{path}' does not exist.")
174172
if not os.path.isdir(path):
175-
raise argparse.ArgumentTypeError(f"{path} is not a valid directory.")
173+
raise argparse.ArgumentTypeError(f"'{path}' is not a directory.")
174+
if not os.access(path, os.R_OK):
175+
raise argparse.ArgumentTypeError(f"You do not have read permissions for '{path}'.")
176176
return path
177177

178178
parser.add_argument(

0 commit comments

Comments
 (0)