Skip to content

Commit

Permalink
Correkted graphics path
Browse files Browse the repository at this point in the history
  • Loading branch information
arne-fuchs committed Jul 6, 2023
1 parent 0adf856 commit fd23829
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/app/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,18 @@ impl Default for Settings {

let mut graphics_directory = json["reader"]["graphics-directory"].to_string();
let mut graphics_path = Path::new(&graphics_directory);
let mut graphics_override_file = graphics_directory.clone();
if !graphics_path.exists() {
if cfg!(target_os = "windows") {
let mut userprofile = env::var("USERPROFILE").unwrap_or("".to_string());
userprofile.push_str("\\AppData\\Frontier Developments\\Elite Dangerous\\Options\\Graphics");
userprofile.push_str("\\AppData\\Local\\Frontier Developments\\Elite Dangerous\\Options\\Graphics");
graphics_directory = userprofile;
graphics_override_file = format!("{}\\GraphicsConfigurationOverride.xml", graphics_directory);
} else if cfg!(target_os = "linux") {
let mut home = env::var("HOME").unwrap_or("~".to_string());
home.push_str("/.steam/root/steamapps/compatdata/359320/pfx/drive_c/users/steamuser/AppData/Local/Frontier Developments/Elite Dangerous/Options/Graphics");
graphics_directory = home;
graphics_override_file = format!("{}/GraphicsConfigurationOverride.xml", graphics_directory);
}
if !Path::new(&graphics_directory).exists() {
graphics_directory = String::from(".");
Expand All @@ -102,7 +105,7 @@ impl Default for Settings {
local_pow: json["local-pow"].as_bool().unwrap(),
password: json["password"].to_string(),
allow_share_data: json["allow-share-data"].as_bool().unwrap(),
graphic_override_content: fs::read_to_string(format!("{}/GraphicsConfigurationOverride.xml", graphics_directory)).unwrap(),
graphic_override_content: fs::read_to_string(graphics_override_file).unwrap(),
show_editor: false,
}
}
Expand Down

0 comments on commit fd23829

Please sign in to comment.