Path Joiner
Build a file path from parts — correctly, for once
- path
Everyone who builds dynamic filenames in ComfyUI eventually writes a broken path: missing separator, hello..png from a double dot, or a path that only works on Windows because the backslashes were hand-typed. Path Joiner is the pack's answer - the boring, correct way to glue a directory, a filename, and an extension into one path string.
It's the inverse of the pack's Path Parser: Parser tears a path apart, Joiner puts it back together. If you're generating output filenames from a prompt, an index, or a timestamp, this is the node that keeps the result sane.
How it works
Takes three strings and joins them with real path logic: it adds the missing trailing separator to the directory, prepends a . to the extension if you forgot it, then runs the result through os.path.normpath so redundant separators and .. segments collapse. An empty filename returns an empty path rather than garbage. Because it uses os.path.join + normpath, the result matches the OS conventions of the machine running ComfyUI - forward slashes on Linux, and it handles Windows-style input gracefully.
Inputs
- directory - the folder path, e.g.
C:\workspaceor/data/images. Trailing separator optional; it gets added. - filename - the base name, e.g.
hello. - extension - e.g.
pngor.png; the dot is added if missing.
Output
path - the assembled, normalized path as a STRING.
Install
Standard pack install - ComfyUI Manager (search "ComfyUI-AutoFlow") or:
cd ComfyUI/custom_nodes
git clone https://github.com/ZXL-Xinram/ComfyUI-AutoFlow
Restart after. No dependencies beyond os.
Where people get burned
- It's a string builder, not a file writer. This node produces a path string. It does not check existence, create directories, or save anything - that's Path Validator's job (checking) and whatever node you're feeding (saving).
- Empty filename → empty path. If
filenameis empty you get""back, silently. If that breaks a downstream node, the error will point at the wrong place. - Extension dots are forgiven, not strict.
pngand.pngboth work, which is friendly - but it means you can't express "no extension" by leaving it empty if you also want a trailing dot (you don't).
For a beginner, this is the node to pair with the pack's String Formatter to build predictable output names like {seed}_{index:03d}.png. It's unglamorous plumbing, but it's the difference between "works on my machine" paths and paths that survive being passed around.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | — | |
| filename | STRING | — | |
| extension | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| path | STRING | — |