Module platform

Module platform 

Source
Expand description

Platform-specific utilities and cross-platform compatibility helpers

This module provides abstractions over platform differences to ensure AGPM works consistently across Windows, macOS, and Linux.

Functionsยง

command_exists
Checks if a command is available in the system PATH.
compute_relative_install_path
Computes the relative install path by removing redundant directory prefixes.
get_cache_dir
Returns the platform-specific cache directory for AGPM.
get_data_dir
Returns the platform-specific data directory for AGPM.
get_git_command
Returns the appropriate Git command name for the current platform.
get_home_dir
Gets the home directory path for the current user.
get_shell_command
Returns the appropriate shell command and flag for the current platform.
is_windows
Checks if the current platform is Windows.
normalize_path_for_storage
Normalizes a path for cross-platform storage by converting all separators to forward slashes.
normalize_path_separator
Converts a path to use the correct separator for the current platform.
path_to_os_str
Returns a path as an OsStr for use in command arguments.
path_to_string
Safely converts a path to a string, handling non-UTF-8 paths gracefully.
paths_equal
Compares two paths for equality, respecting platform case sensitivity rules.
resolve_path
Resolves a path with tilde expansion and environment variable substitution.
safe_canonicalize
Canonicalizes a path with proper cross-platform handling.
safe_join
Safely joins a base path with a relative path, preventing directory traversal.
validate_path_chars
Validates that a path contains only characters valid for the current platform.
windows_long_path
No-op implementation of windows_long_path for non-Windows platforms.