mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2026-11-04 23:37:31 +00:00
[GH-ISSUE #3171] [Desktop] Provide a supported native directory-picker API for custom nodes/extensions #1115
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/ComfyUI-Manager#1115
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @cogfilms-3D on GitHub (Aug 15, 2026).
Original GitHub issue: https://github.com/Comfy-Org/ComfyUI-Manager/issues/3171
Description
I am developing a ComfyUI custom node which needs to allow the user to select a filesystem directory for saving generated assets.
The node is called Production Slate V4 and is intended for production workflow management. It creates a project/scene directory structure and saves rendered images directly to the selected filesystem location.
I have been testing this under ComfyUI Desktop on Windows 11.
The problem is that browser-based directory selection and the current window.__comfyDesktop2 bridge do not appear to provide a suitable documented API for a custom node to obtain a normal filesystem path from a native folder picker.
I believe ComfyUI Desktop should provide a supported, narrowly scoped native directory-picker API for custom node JavaScript extensions.
I am not suggesting that arbitrary Electron filesystem APIs should be exposed to custom nodes. A restricted API which opens the native directory-selection dialog and returns the user-selected path would provide the required functionality while maintaining a sensible security boundary.
Environment
Operating system: Windows 11
ComfyUI: 0.33.1
ComfyUI Desktop: Desktop installation
Python: 3.12.9
PyTorch: 2.10.0+cu130
GPU: NVIDIA GeForce RTX 4060 Ti 16GB
Frontend: ComfyUI Desktop frontend
The ComfyUI startup configuration includes:
Expected behaviour
A custom-node JavaScript extension should have a supported way to do something equivalent to:
const selectedPath = await nativeDirectoryPicker();where:
For example:
The Python backend can then use the path normally.
Actual behaviour
The current window.__comfyDesktop2 object is available to custom-node JavaScript, but it does not expose a directory-picker function.
I tested the object and obtained the following available functions/objects:
There is no:
showDirectoryPickeror equivalent filesystem directory-selection function.
Our diagnostic therefore reports:
Investigation
I initially attempted to use the browser API:
window.showDirectoryPicker()However, this does not provide the same useful result for this application as a native Desktop API returning a normal filesystem path.
I then investigated whether ComfyUI Desktop exposes a native Electron bridge.
window.__comfyDesktop2 is present, confirming that the Desktop host bridge is available.
However, showDirectoryPicker() is not part of the exposed bridge.
Interestingly, the current Comfy Desktop source appears to contain a native directory-picker implementation internally.
The current Desktop source contains:
and the Desktop constants contain:
SHOW_DIRECTORY_PICKER: 'show-directory-picker'This suggests that the native capability exists within the Desktop application but is not currently exposed through the window.__comfyDesktop2 interface available to custom-node extensions.
Why this matters for custom nodes
There are many legitimate uses for a native directory picker in custom nodes, including:
For example, my Production Slate node currently needs to create:
The user should be able to select F:\AI_Films using a normal native folder-selection dialog rather than having to manually type the path.
Security consideration
I understand that exposing Electron APIs directly to arbitrary custom-node JavaScript would have significant security implications.
I am not proposing that arbitrary filesystem APIs be exposed.
In fact, I think the restricted bridge approach is preferable.
A dedicated API such as:
window.__comfyDesktop2.showDirectoryPicker()which:
would seem to provide a reasonable security boundary.
This would also avoid custom nodes attempting to access undocumented or private Electron functionality.
Reproduction
A minimal reproduction is:
Add a button to a custom node.
This succeeds.
console.log(typeof desktop.showDirectoryPicker);Result:
undefined4. Diagnostic result
Additional testing
I also tested the possibility of using:
window.electronAPIbut the expected Electron API was not exposed in the current Desktop environment.
The current window.__comfyDesktop2 bridge was therefore investigated instead.
During this investigation I was able to establish that the Desktop application's internal native directory-picker functionality exists, but it is not exposed through the bridge available to the custom-node frontend.
Question / requested feature
Could ComfyUI Desktop expose a documented, supported native directory-picker API through the current Desktop bridge?
Something along the lines of:
const path = await window.__comfyDesktop2.showDirectoryPicker();would solve this cleanly.
If there is already a supported API for this purpose, could it be documented for custom-node/extension developers?
If the capability is deliberately not exposed for security reasons, could you advise what the recommended mechanism is for a custom node that legitimately needs the user to select an external filesystem directory?
Relevant architectural context
I found the current ComfyUI frontend Desktop-parity discussion, which states that ComfyUI Desktop hosts the normal localhost frontend and exposes host functionality through server feature flags and window.__comfyDesktop2, and that native functionality should check the actual bridge/API capability.
This seems particularly relevant to this request because the native directory-picker capability appears to exist internally in Desktop, while the equivalent capability is not currently available to custom-node JavaScript.
Additional information
This is being encountered while developing a production-oriented custom node, rather than attempting to circumvent the ComfyUI filesystem security model.
The node already works correctly when supplied with a filesystem path manually. The only missing piece is a convenient and supported way for the user to select that path using the native Desktop UI.
I would be happy to provide the minimal custom-node test code used to reproduce this if required.