Skip to content

Commit bc21c62

Browse files
committed
Fix: Detect workspace as default when it matches cwd (#311)
- detect WorkspaceType.DEFAULT when run from default directory - use --here to detect as WorkspaceType.CURRENT_DIR instead
1 parent 078ef4b commit bc21c62

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

comfy_cli/workspace_manager.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,18 +230,22 @@ def get_workspace_path(self) -> tuple[str, WorkspaceType]:
230230
WorkspaceType.CURRENT_DIR,
231231
)
232232

233+
# Check for user-set default workspace
234+
default_workspace = self.config_manager.get(constants.CONFIG_KEY_DEFAULT_WORKSPACE)
235+
valid_default_workspace = default_workspace and check_comfy_repo(default_workspace)[0]
236+
233237
# Check the current directory for a ComfyUI
234238
if self.use_here is None:
235239
current_directory = os.getcwd()
236240
found_comfy_repo, comfy_repo = check_comfy_repo(os.path.join(current_directory))
237241
# If it's in a sub dir of the ComfyUI repo, get the repo working dir
238242
if found_comfy_repo:
239-
return comfy_repo.working_dir, WorkspaceType.CURRENT_DIR
240-
241-
# Check for user-set default workspace
242-
default_workspace = self.config_manager.get(constants.CONFIG_KEY_DEFAULT_WORKSPACE)
243+
w_type = WorkspaceType.CURRENT_DIR
244+
if valid_default_workspace and default_workspace == current_directory:
245+
w_type = WorkspaceType.DEFAULT
246+
return comfy_repo.working_dir, w_type
243247

244-
if default_workspace and check_comfy_repo(default_workspace)[0]:
248+
if valid_default_workspace:
245249
return default_workspace, WorkspaceType.DEFAULT
246250

247251
# Fallback to the most recent workspace if it exists

0 commit comments

Comments
 (0)