| Crates.io | vx-paths |
| lib.rs | vx-paths |
| version | 0.3.1 |
| created_at | 2025-06-19 12:32:53.639382+00 |
| updated_at | 2025-06-19 13:51:04.096793+00 |
| description | Cross-platform path management for vx tool installations |
| homepage | https://github.com/loonghao/vx |
| repository | https://github.com/loonghao/vx |
| max_upload_size | |
| id | 1718308 |
| size | 38,534 |
Cross-platform path management for vx tool installations.
vx-paths provides a unified interface for managing tool installation paths across different platforms, ensuring consistent directory structures and proper handling of executable file extensions.
~/.vx/tools/<tool>/<version>/<tool>.exe structure~/.vx/
├── tools/ # Tool installations
│ ├── node/
│ │ ├── 18.17.0/
│ │ │ └── node.exe # Windows
│ │ │ └── node # Unix
│ │ └── 20.0.0/
│ │ └── node.exe
│ └── uv/
│ └── 0.1.0/
│ └── uv.exe
├── cache/ # Download cache
├── config/ # Configuration files
└── tmp/ # Temporary files
use vx_paths::PathManager;
// Create path manager with default locations
let manager = PathManager::new()?;
// Get tool executable path
let node_path = manager.tool_executable_path("node", "18.17.0");
// Returns: ~/.vx/tools/node/18.17.0/node.exe (Windows)
// ~/.vx/tools/node/18.17.0/node (Unix)
// Check if tool is installed
let is_installed = manager.is_tool_version_installed("node", "18.17.0");
// List all versions of a tool
let versions = manager.list_tool_versions("node")?;
// Get latest version
let latest = manager.get_latest_tool_version("node")?;
use vx_paths::{PathManager, PathResolver};
let manager = PathManager::new()?;
let resolver = PathResolver::new(manager);
// Find all executables for a tool
let executables = resolver.find_tool_executables("node")?;
// Find latest executable
let latest_exe = resolver.find_latest_executable("node")?;
// Resolve with version preference
let exe_path = resolver.resolve_tool_path("node", Some("18.17.0"))?;
use vx_paths::{PathConfig, PathManager};
// Create with custom base directory
let config = PathConfig::with_base_dir("/custom/vx");
let manager = config.create_path_manager()?;
// Load from environment variables
let config = PathConfig::from_env();
let manager = config.create_path_manager()?;
VX_BASE_DIR: Custom base directoryVX_TOOLS_DIR: Custom tools directoryVX_CACHE_DIR: Custom cache directoryVX_CONFIG_DIR: Custom config directoryVX_TMP_DIR: Custom temporary directoryuse vx_paths::PathManager;
use vx_core::VxConfig;
// Integrate with vx configuration
let path_manager = PathManager::new()?;
let config = VxConfig {
install_dir: path_manager.tools_dir().to_path_buf(),
cache_dir: path_manager.cache_dir().to_path_buf(),
// ... other config
};
cargo test
This project is licensed under the MIT License - see the LICENSE file for details.