desktop: Add cache directory to options
This commit is contained in:
parent
22fda90f92
commit
3da0246856
|
@ -25,6 +25,12 @@ fn get_default_config_directory() -> std::path::PathBuf {
|
|||
.join("ruffle")
|
||||
}
|
||||
|
||||
fn get_default_cache_directory() -> std::path::PathBuf {
|
||||
dirs::cache_dir()
|
||||
.expect("Couldn't find a valid cache dir")
|
||||
.join("ruffle")
|
||||
}
|
||||
|
||||
#[derive(Parser, Debug, Clone)]
|
||||
#[clap(
|
||||
name = "Ruffle",
|
||||
|
@ -113,6 +119,12 @@ pub struct Opt {
|
|||
#[clap(long, default_value_os_t=get_default_config_directory())]
|
||||
pub config: std::path::PathBuf,
|
||||
|
||||
/// Directory that contains non-essential files created by Ruffle.
|
||||
///
|
||||
/// This directory can be deleted without affecting functionality.
|
||||
#[clap(long, default_value_os_t=get_default_cache_directory())]
|
||||
pub cache_directory: std::path::PathBuf,
|
||||
|
||||
/// Proxy to use when loading movies via URL.
|
||||
#[clap(long)]
|
||||
pub proxy: Option<Url>,
|
||||
|
|
|
@ -43,6 +43,7 @@ pub struct LaunchOptions {
|
|||
pub tcp_connections: Option<SocketMode>,
|
||||
pub fullscreen: bool,
|
||||
pub save_directory: PathBuf,
|
||||
pub cache_directory: PathBuf,
|
||||
pub open_url_mode: OpenURLMode,
|
||||
pub gamepad_button_mapping: HashMap<GamepadButton, KeyCode>,
|
||||
pub avm2_optimizer_enabled: bool,
|
||||
|
@ -90,6 +91,7 @@ impl From<&GlobalPreferences> for LaunchOptions {
|
|||
proxy: value.cli.proxy.clone(),
|
||||
fullscreen: value.cli.fullscreen,
|
||||
save_directory: value.cli.save_directory.clone(),
|
||||
cache_directory: value.cli.cache_directory.clone(),
|
||||
open_url_mode: value.cli.open_url_mode,
|
||||
socket_allowed: HashSet::from_iter(value.cli.socket_allow.iter().cloned()),
|
||||
tcp_connections: value.cli.tcp_connections,
|
||||
|
@ -193,6 +195,7 @@ impl ActivePlayer {
|
|||
tcp_connections: opt.tcp_connections,
|
||||
fullscreen: opt.fullscreen,
|
||||
save_directory: opt.save_directory.clone(),
|
||||
cache_directory: opt.cache_directory.clone(),
|
||||
open_url_mode: opt.open_url_mode,
|
||||
gamepad_button_mapping: opt.gamepad_button_mapping.clone(),
|
||||
avm2_optimizer_enabled: opt.avm2_optimizer_enabled,
|
||||
|
|
Loading…
Reference in New Issue