diff --git a/README.md b/README.md index 4b0822a..a9c944d 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ The `FilePathExtractor` is a custom node extension for ComfyUI designed to extra - **Extract Folder Path**: Provides the absolute path to the folder. ### Inputs -1. **test** (required): +1. **path** (required): - Type: STRING - Default: `""` - Description: The path to a file or folder from which to extract information. diff --git a/__init__.py b/__init__.py index 7613255..8f6279b 100644 --- a/__init__.py +++ b/__init__.py @@ -1,11 +1,14 @@ from .file_path_creator import FilePathCreator +from .file_path_extractor import FilePathExtractor NODE_CLASS_MAPPINGS = { - "FilePathCreator": FilePathCreator + "FilePathCreator": FilePathCreator, + "FilePathExtractor": FilePathExtractor } NODE_DISPLAY_NAME_MAPPINGS = { - "FilePathCreator": "File Path Creator" + "FilePathCreator": "File Path Creator", + "FilePathExtractor": "File Path Extractor" } __all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS'] diff --git a/file_path_extractor.py b/file_path_extractor.py index dac89db..d6a7ce0 100644 --- a/file_path_extractor.py +++ b/file_path_extractor.py @@ -5,7 +5,7 @@ class FilePathExtractor: def INPUT_TYPES(cls): return { "required": { - "test": ("STRING", {"default": ""}) + "path": ("STRING", {"default": ""}) } } @@ -18,16 +18,16 @@ class FilePathExtractor: def IS_CHANGED(): return True - def process(self, test): - if os.path.isfile(test): - file_name = os.path.basename(test) - file_extension = os.path.splitext(test)[1][1:] - folder_path = os.path.dirname(test) + def process(self, path): + if os.path.isfile(path): + file_name = os.path.basename(path) + file_extension = os.path.splitext(path)[1][1:] + folder_path = os.path.dirname(path) folder_name = os.path.basename(folder_path) - elif os.path.isdir(test): + elif os.path.isdir(path): file_name = "" file_extension = "" - folder_path = os.path.abspath(test) + folder_path = os.path.abspath(path) folder_name = os.path.basename(folder_path) else: file_name = ""