Skip to content

env_path

XulbuX edited this page Sep 11, 2025 · 2 revisions

EnvPath

This class includes methods to work with the PATH variable from the environment variables.


paths()

This method will return the PATH variable as a string or a list with the separated paths.
Param:as_list: bool = False whether to return the paths as a list or a string
Returns: the PATH variable as a string or a list


has_path()

This method will check if a path is present in the PATH variable.
Params:

  • path: Optional[str] = None the path to check
  • cwd: bool = False whether to check if CWD path is present
  • base_dir: bool = False whether to check if the base directory path is present

Returns:True if the path is present in the PATH variable, False otherwise


add_path()

This method will add a path to the PATH variable (if it's not already present).
Params:

  • path: Optional[str] = None the path to add
  • cwd: bool = False whether to add the current working directory path
  • base_dir: bool = False whether to add the base directory path

Returns:no return value


remove_path()

This method will remove a path from the PATH variable (if it's present).
Params:

  • path: Optional[str] = None the path to remove
  • cwd: bool = False whether to remove the current working directory path
  • base_dir: bool = False whether to remove the base directory path

Returns:no return value

★⠀Python Library by XulbuX⠀★

Project Links

Testing and Formatting

Classifiers

  • Intended Audience:
    • Developers
  • License:
    • OSI Approved
    • MIT License
  • Operating Systems:
    • Full Library: OS Independent
  • Supported Python Versions:
    • Python 3.13
    • Python 3.12
    • Python 3.11
    • Python 3.10
  • Topics:
    • Libraries
    • Python Modules
    • Software Development

The XulbuX Logo
Clone this wiki locally