-
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.
Refactor authentication components, update dependencies, and improve …
…error handling
- Loading branch information
Showing
13 changed files
with
142 additions
and
169 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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,25 +1,33 @@ | ||
use std::path::PathBuf; | ||
|
||
use dirs; | ||
use directories::ProjectDirs; | ||
use dotenv_codegen::dotenv; | ||
|
||
pub fn app_config_dir() -> Option<PathBuf> { | ||
dirs::config_dir().map(|mut p| { | ||
p.push(dotenv!("JLUD_APP_NAME")); | ||
p | ||
}) | ||
#[derive(Debug)] | ||
pub struct JludPath { | ||
/// Path to the configuration file | ||
pub config: PathBuf, | ||
/// Path to the user data file | ||
pub user: PathBuf, | ||
} | ||
|
||
pub fn app_config_file() -> Option<PathBuf> { | ||
app_config_dir().map(|mut p| { | ||
p.push(dotenv!("JLUD_APP_CONFIG_FILE")); | ||
p | ||
}) | ||
impl JludPath { | ||
pub fn new(config: PathBuf, user: PathBuf) -> Self { | ||
Self { config, user } | ||
} | ||
} | ||
|
||
pub fn app_password_file() -> Option<PathBuf> { | ||
app_config_dir().map(|mut p| { | ||
p.push(dotenv!("JLUD_APP_PASSWORD_FILE")); | ||
p | ||
}) | ||
impl From<ProjectDirs> for JludPath { | ||
fn from(dirs: ProjectDirs) -> Self { | ||
Self { | ||
config: dirs | ||
.config_dir() | ||
.to_path_buf() | ||
.join(dotenv!("JLUD_APP_CONFIG_FILE")), | ||
user: dirs | ||
.cache_dir() | ||
.to_path_buf() | ||
.join(dotenv!("JLUD_APP_PASSWORD_FILE")), | ||
} | ||
} | ||
} |
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
Oops, something went wrong.