INNER CODE UNIT · Rust

get_plugin_path

Drew-Alleman/DataSurgeon · src/plugins/mod.rs:26

fn get_plugin_path() -> String {
    #[cfg(target_os = "windows")]
    {
        return String::from("C:\\ds\\plugins.json");
    }

    #[cfg(unix)] // This targets all Unix-like systems, including Linux and macOS
    {
        let home_dir = std::env::var("HOME").expect("Home directory not found. Failed to read environmental variable: `HOME`.");
        return format!("{}/.DataSurgeon/plugins.json", home_dir);
    }

    #[cfg(not(any(target_os = "windows", unix)))] // Fallback for other platforms
    {
        panic!("Unsupported platform");
    }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…