aboutsummaryrefslogtreecommitdiff
path: root/launcher/src/search_path.rs
blob: 6c3b9208398bc7cb3e9da05a89406e27312816f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
use std::path::PathBuf;

fn get_home() -> PathBuf {
    dirs::home_dir().unwrap_or(PathBuf::from("/"))
}

#[cfg(target_os = "macos")]
fn get_home_search() -> PathBuf {
    let mut path = get_home();
    path.push("/Library/Frameworks/AtomicRuntime.framework");
    path
}

#[cfg(target_os = "linux")]
fn get_home_search() -> PathBuf {
    let mut path = get_home();
    path.push("/.local/share/atomic-runtime");
    path
}

#[cfg(target_os = "windows")]
fn get_home_search() -> PathBuf {
    let mut path = get_home();
    path.push("\\AppData\\Local\\Atomic Runtime");
    path
}

#[cfg(target_os = "macos")]
pub fn get_search_paths() -> [PathBuf; 5] {
    [
        PathBuf::from("/Library/Frameworks/AtomicRuntime.framework"),
        PathBuf::from("/System/Library/Frameworks/AtomicRuntime.framework"),
        PathBuf::from("/usr/local/lib/atomic-runtime"),
        PathBuf::from("/opt/atomic-runtime"),
        get_home_search(),
    ]
}

#[cfg(target_os = "linux")]
pub fn get_search_paths() -> [PathBuf; 8] {
    [
        PathBuf::from("/usr/local/lib/atomic-runtime"),
        PathBuf::from("/usr/local/lib64/atomic-runtime"),
        PathBuf::from("/usr/lib/atomic-runtime"),
        PathBuf::from("/usr/lib64/atomic-runtime"),
        PathBuf::from("/lib/atomic-runtime"),
        PathBuf::from("/lib64/atomic-runtime"),
        PathBuf::from("/opt/atomic-runtime"),
        get_home_search(),
    ]
}

#[cfg(target_os = "windows")]
pub fn get_search_paths() -> [PathBuf; 29] {
    [
        PathBuf::from("C:\\Program Files\\Common Files\\Equestria.dev\\AtomicRuntime"),
        PathBuf::from("C:\\Program Files\\Common Files\\Equestria.dev\\Atomic Runtime"),
        PathBuf::from("C:\\Program Files (x86)\\Common Files\\Equestria.dev\\AtomicRuntime"),
        PathBuf::from("C:\\Program Files (x86)\\Common Files\\Equestria.dev\\Atomic Runtime"),
        PathBuf::from("C:\\Program Files (Arm)\\Common Files\\Equestria.dev\\AtomicRuntime"),
        PathBuf::from("C:\\Program Files (Arm)\\Common Files\\Equestria.dev\\Atomic Runtime"),
        PathBuf::from("C:\\Program Files\\Common Files\\AtomicRuntime"),
        PathBuf::from("C:\\Program Files\\Common Files\\Atomic Runtime"),
        PathBuf::from("C:\\Program Files (x86)\\Common Files\\AtomicRuntime"),
        PathBuf::from("C:\\Program Files (x86)\\Common Files\\Atomic Runtime"),
        PathBuf::from("C:\\Program Files (Arm)\\Common Files\\AtomicRuntime"),
        PathBuf::from("C:\\Program Files (Arm)\\Common Files\\Atomic Runtime"),
        PathBuf::from("C:\\Windows\\AtomicRuntime"),
        PathBuf::from("C:\\Windows\\Atomic Runtime"),
        PathBuf::from("C:\\Program Files\\Equestria.dev\\AtomicRuntime"),
        PathBuf::from("C:\\Program Files\\Equestria.dev\\Atomic Runtime"),
        PathBuf::from("C:\\Program Files (x86)\\Equestria.dev\\AtomicRuntime"),
        PathBuf::from("C:\\Program Files (x86)\\Equestria.dev\\Atomic Runtime"),
        PathBuf::from("C:\\Program Files (Arm)\\Equestria.dev\\AtomicRuntime"),
        PathBuf::from("C:\\Program Files (Arm)\\Equestria.dev\\Atomic Runtime"),
        PathBuf::from("C:\\Program Files\\AtomicRuntime"),
        PathBuf::from("C:\\Program Files\\Atomic Runtime"),
        PathBuf::from("C:\\Program Files (x86)\\AtomicRuntime"),
        PathBuf::from("C:\\Program Files (x86)\\Atomic Runtime"),
        PathBuf::from("C:\\Program Files (Arm)\\AtomicRuntime"),
        PathBuf::from("C:\\Program Files (Arm)\\Atomic Runtime"),
        PathBuf::from("C:\\ProgramData\\AtomicRuntime"),
        PathBuf::from("C:\\ProgramData\\Atomic Runtime"),
        get_home_search(),
    ]
}