ComfyUI_Comfyroll_CustomNodes icon indicating copy to clipboard operation
ComfyUI_Comfyroll_CustomNodes copied to clipboard

CR Save Text to File Node does not work correctly

Open Joly0 opened this issue 1 year ago • 1 comments

I have noticed, that files saved using that node use a "" instead of "/" for the concatenation between the path string and the filename string. So when i put path as "/config/images" and the filename is "comfyui01.png", then the output path would be "/config/images\comfyui01.txt".

Somehow then this is not correctly saved and the file ends up as this "/config/56as4dfg56.txt"

I got around this by changing this line https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/d78b780ae43fcf8c6b7c6505e6ffb4584281ceca/nodes/nodes_utils_text.py#L165 to: filepath = output_file_path + "/" + file_name + "." + file_extension

I might assume, that this is only an issue on linux, as in windows the delimiter for paths is \ and not / like for linux.

Some check here might be useful. Though i think instead of checking the os, it should check the delimiter of the input path and try to parse, which one is used there

Though i noticed, with my change the path thats outputed in the log is shown as "/config/images//comfyui01.txt", so double // here, but its still saving correctly

Joly0 avatar Jun 20 '24 14:06 Joly0

The right way to do this is with os.path.join, which will automatically use the appropriate delimiter for whatever OS the user is running on.

colinmorris avatar Aug 31 '24 14:08 colinmorris