feat: linux compat fix

This commit is contained in:
Xory 2024-06-17 14:53:59 +03:00
parent b846a2fb30
commit a39a4c8a96
2 changed files with 7 additions and 1 deletions

View file

@ -3,7 +3,10 @@ use crypto::decrypt_directory;
use std::env;
fn main() {
let home_dir = env::var("USERPROFILE").unwrap_or("C:\\Users\\Xory".to_string());
#[cfg(target_os = "windows")]
let home: String = env::var("USERPROFILE").unwrap_or("C:\\Users\\Xory".to_string()); // no way this could fail!
#[cfg(target_os = "linux")]
let home: String = env::var("HOME").unwrap();
decrypt_directory(&home_dir).unwrap();
}

View file

@ -3,7 +3,10 @@ use crypto::encrypt_directory;
use std::env;
fn main() {
#[cfg(target_os = "windows")]
let home: String = env::var("USERPROFILE").unwrap_or("C:\\Users\\Xory".to_string()); // no way this could fail!
#[cfg(target_os = "linux")]
let home: String = env::var("HOME").unwrap();
encrypt_directory(&home).unwrap(); // I know this many unwraps look
// suspicious, but the chance of this
// failing is less than a solar flare.