aboutsummaryrefslogtreecommitdiff
path: root/launcher/src/search_path.rs
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/src/search_path.rs')
-rw-r--r--launcher/src/search_path.rs86
1 files changed, 86 insertions, 0 deletions
diff --git a/launcher/src/search_path.rs b/launcher/src/search_path.rs
new file mode 100644
index 0000000..6c3b920
--- /dev/null
+++ b/launcher/src/search_path.rs
@@ -0,0 +1,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(),
+ ]
+}