Platform Base¶
base
¶
Abstract base class for platform-specific operations.
This abstraction layer enables cross-platform support by defining a common interface for operations that differ between Windows, Linux, and macOS.
Platform
¶
Bases: ABC
Abstract base class for platform-specific operations.
name
abstractmethod
property
¶
Platform name (e.g. 'windows', 'linux', 'macos').
create_link(source, target, log=None)
¶
Create a directory link (junction on Windows, symlink on Unix).
The default implementation creates a POSIX symlink. WindowsPlatform overrides this with NTFS junctions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Path
|
The link path to create (inside ComfyUI). |
required |
target
|
Path
|
The target path (external folder). |
required |
log
|
InstallerLogger | None
|
Optional logger instance. Falls back to the singleton. |
None
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If link creation fails. |
Source code in src/platform/base.py
is_admin()
abstractmethod
¶
enable_long_paths(log=None)
abstractmethod
¶
Enable support for long file paths (>260 chars).
Returns:
| Type | Description |
|---|---|
bool
|
True if long paths were enabled or already enabled. |
detect_python(version='3.13', log=None)
abstractmethod
¶
Detect a specific Python version on the system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str
|
The Python version to look for (e.g. "3.13"). |
'3.13'
|
log
|
InstallerLogger | None
|
Optional logger instance. |
None
|
Returns:
| Type | Description |
|---|---|
Path | None
|
Path to the Python executable, or None if not found. |
Source code in src/platform/base.py
get_app_data_dir()
abstractmethod
¶
is_link(path)
¶
Check if a path is a link (junction or symlink).
Source code in src/platform/base.py
get_platform()
¶
Detect and return the appropriate Platform implementation.
Returns:
| Type | Description |
|---|---|
Platform
|
A Platform instance for the current OS. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the current OS is not supported. |