This commit is contained in:
meehl committed 2026-09-02 16:37:59 +02:00
1 parent aa1bfb768e
commit 20a1db073d
20 files changed
+118 -126

No files matched your search

+7 -12
View File
@@ -1,14 +1,9 @@
//! `args` is used to parse the arguments passed to the program on launch.
//!
//! Normally these are the arguments passed after the `rusty-path-of-building`
//! command from a CLI.
use clap::Parser;
use clap::ValueEnum;
use directories::BaseDirs;
use std::path::PathBuf;
/// CLI arguments passed to the application on launch.
/// CLI arguments passed to the application.
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
pub struct Args {
@@ -23,7 +18,7 @@ pub struct Args {
pub import_url: Option<String>,
}
/// Enum representing which game (PoE1 or PoE2) the application needs to launch.
/// Enum representing the game version.
#[derive(Debug, Clone, Copy, ValueEnum)]
pub enum Game {
/// Path of Exile 1
@@ -35,17 +30,17 @@ pub enum Game {
}
impl Game {
/// Returns the path to the user’s data directory based on which `Game` option
/// was used to start the application.
/// Returns the path to the user’s data directory based on which `Game` option was used to
/// start the application.
pub fn data_dir(&self) -> PathBuf {
let directory_name = match self {
Game::Poe1 => "RustyPathOfBuilding1",
Game::Poe2 => "RustyPathOfBuilding2",
Self::Poe1 => "RustyPathOfBuilding1",
Self::Poe2 => "RustyPathOfBuilding2",
};
BaseDirs::new().unwrap().data_dir().join(directory_name)
}
/// Returns the path to the user's data directory. Calls [`Self::data_dir`].
/// Returns the path to the user's data directory.
pub fn script_dir(&self) -> PathBuf {
self.data_dir()
}