WASasquatch / was-node-suite-comfyui

An extensive node suite for ComfyUI with over 210 new nodes
MIT License
1.23k stars 178 forks source link

Expand environment variables in file paths for dynamic loading from file #463

Closed Geeknasty closed 2 months ago

Geeknasty commented 3 months ago

Overview

This pull request introduces a feature to enhance file loading functionality across the WAS Node Suite by supporting environment variables in file paths. This change ensures that paths containing variables such as %userprofile% are correctly expanded and interpreted, allowing for more dynamic and flexible file loading.

Changes Made

  1. WAS_Text_Load_Line_From_File:

    • Updated the load_file method to expand environment variables in the file_path using os.path.expandvars().
    • This change resolves an issue where paths with environment variables could not be found, resulting in errors.
  2. WAS_Text_Load_From_File:

    • Applied the same update to the load_file method in this class to ensure consistent behavior.
    • Environment variables in the file_path are now properly expanded before the path is used.

Impact

Additional Notes