Skip to main content

Crate fabricatio_constants

Crate fabricatio_constants 

Source
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:

PlatformConfig DirectoryExample
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.