Expand description
§Fabricatio Constants
A foundational constants crate for the Fabricatio ecosystem, providing application-wide constants, paths, and configuration variables.
This crate centralizes all constants used across the Fabricatio project, including application names, configuration file paths, directory locations, and environment variable names. It ensures consistency and provides a single source of truth for these values.
§Features
- Application Constants: Centralized definitions for application name, repository details, and core package names
- Path Management: Automatic determination of user configuration directories across different operating systems
- Template Support: Constants for template directory management and global configuration files
- Environment Variables: Standardized names for configuration and logging variables
§Platform Support
The crate automatically detects the user’s operating system and provides appropriate paths:
| Platform | Config Directory | Example |
|---|---|---|
| Linux | $XDG_CONFIG_HOME or $HOME/.config | /home/alice/.config/fabricatio |
| macOS | $HOME/Library/Application Support | /Users/Alice/Library/Application Support/fabricatio |
| Windows | {FOLDERID_RoamingAppData} | C:\Users\Alice\AppData\Roaming\fabricatio |
§Usage
use fabricatio_constants::{NAME, ROAMING, GLOBAL_CONFIG_FILE};
fn main() {
println!("Application: {}", NAME);
println!("Config directory: {:?}", ROAMING);
println!("Config file: {:?}", GLOBAL_CONFIG_FILE);
}For more information, see the README.
Constants§
- CONFIG_
FILE - The default configuration file name used by the application.
- CONFIG_
VARNAME - The name of the configuration variable used by the application.
- CORE_
PACKAGE_ NAME - The name of the core package used by the application.
- LOGGER_
VARNAME - The name of the logger variable used by the application.
- NAME
- The application name used across the project.
- PY_
SOURCE_ KEY - The key used to store the Python source code path.
- REPO_
NAME - The GitHub repository name for the application.
- REPO_
OWNER - The GitHub repository owner for the application.
- TEMPLATES_
DIRNAME - The name of the templates’ directory.
Statics§
- GLOBAL_
CONFIG_ FILE - A global static instance of the global configuration file path, constructed by joining the roaming directory with the application-specific configuration file name.
- ROAMING
- A global static instance of the user’s roaming configuration directory for the application.
- TEMPLATES
- A global static instance of the templates directory located within the roaming configuration directory.