- changed input parameter name for FilePathExtractor

- added FilePathExtractor to the init file
This commit is contained in:
HECer
2024-10-20 15:11:40 +02:00
parent 4ccad8d457
commit 32e01d518c
3 changed files with 14 additions and 11 deletions
+1 -1
View File
@@ -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.
+5 -2
View File
@@ -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']
+8 -8
View File
@@ -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 = ""