-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: split loading functionality into discover_and_assume
The `discover_and_assume` function adds an opinionated handling of what to do when a value isn't found. It will append directory names to the data, config, and cache directories as subdirectories of the project root. If the project id can't be determined it will check the config directory for a special file.
- Loading branch information
1 parent
452cb89
commit c2cd843
Showing
4 changed files
with
106 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
const PRJ_ROOT: &str = "PRJ_ROOT"; | ||
const PRJ_CONFIG_HOME: &str = "PRJ_CONFIG_HOME"; | ||
const PRJ_DATA_HOME: &str = "PRJ_DATA_HOME"; | ||
const PRJ_ID: &str = "PRJ_ID"; | ||
const PRJ_CACHE: &str = "PRJ_CACHE"; | ||
pub const PROJECT_ROOT: &str = "PRJ_ROOT"; | ||
pub const PROJECT_CONFIG_HOME: &str = "PRJ_CONFIG_HOME"; | ||
pub const PROJECT_DATA_HOME: &str = "PRJ_DATA_HOME"; | ||
pub const PROJECT_ID: &str = "PRJ_ID"; | ||
pub const PROJECT_CACHE: &str = "PRJ_CACHE"; | ||
|
||
const PRJ_ID_FILE: &str = "prj_id"; | ||
pub const PROJECT_ID_FILE: &str = "prj_id"; | ||
|
||
// default values for directories that are not set | ||
pub const DEFAULT_CONFIG_HOME: &str = ".config"; | ||
pub const DEFAULT_DATA_HOME: &str = ".data"; | ||
pub const DEFAULT_CACHE_HOME: &str = ".cache"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters