forked from Drop-OSS/archived-drop-app
Some checks failed
publish / publish-tauri (, ubuntu-22.04) (release) Failing after 14m38s
publish / publish-tauri (, windows-latest) (release) Has been cancelled
publish / publish-tauri (--target aarch64-apple-darwin, macos-14) (release) Has been cancelled
publish / publish-tauri (--target aarch64-unknown-linux-gnu, ubuntu-22.04-arm) (release) Has been cancelled
publish / publish-tauri (--target x86_64-apple-darwin, macos-14) (release) Has been cancelled
* feat: depot api downloads * feat: frontend fixes and experimental webview store * feat: sync downloader * feat: cleanup and fixes * feat: encrypted database and fixed resuming * feat: launch option selector * fix: autostart when no options * fix: clippy * fix: clippy x2 * feat: executor launch * feat: executor launch * feat: not installed error handling * feat: better offline handling * feat: dependency popup * fix: cancelation and resuming issues * feat: dedup by platform * feat: new ui for additional components and fix dl manager clog * feat: auto-queue dependencies * feat: depot scanning and ranking * feat: new library fetching stack * In-app store page (Windows + macOS) (#176) * feat: async store loading * feat: fix overscroll behaviour * fix: query params in server protocol * fix: clippy
48 lines
1.3 KiB
Rust
48 lines
1.3 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Eq, Hash, PartialEq, Serialize, Deserialize, Clone, Copy, Debug, PartialOrd, Ord)]
|
|
pub enum Platform {
|
|
Windows,
|
|
Linux,
|
|
#[allow(non_camel_case_types)]
|
|
macOS,
|
|
}
|
|
|
|
impl Platform {
|
|
#[cfg(target_os = "windows")]
|
|
pub const HOST: Platform = Self::Windows;
|
|
#[cfg(target_os = "macos")]
|
|
pub const HOST: Platform = Self::macOS;
|
|
#[cfg(target_os = "linux")]
|
|
pub const HOST: Platform = Self::Linux;
|
|
|
|
pub fn is_case_sensitive(&self) -> bool {
|
|
match self {
|
|
Self::Windows | Self::macOS => false,
|
|
Self::Linux => true,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<&str> for Platform {
|
|
fn from(value: &str) -> Self {
|
|
match value.to_lowercase().trim() {
|
|
"windows" => Self::Windows,
|
|
"linux" => Self::Linux,
|
|
"mac" | "macos" => Self::macOS,
|
|
_ => unimplemented!(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<whoami::Platform> for Platform {
|
|
fn from(value: whoami::Platform) -> Self {
|
|
match value {
|
|
whoami::Platform::Windows => Platform::Windows,
|
|
whoami::Platform::Linux => Platform::Linux,
|
|
whoami::Platform::MacOS => Platform::macOS,
|
|
platform => unimplemented!("Playform {} is not supported", platform),
|
|
}
|
|
}
|
|
}
|