commit b5db7ba2d5e8a07d883576615ccdf6bc2cab95d0 Author: monoid Date: Thu Jun 26 18:51:51 2025 +0900 init: Initial commit diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..5e81e62 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,476 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "anstream" +version = "0.6.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.59.0", +] + +[[package]] +name = "bitflags" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" + +[[package]] +name = "cfg-if" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" + +[[package]] +name = "clap" +version = "4.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "ionian-find" +version = "0.1.0" +dependencies = [ + "clap", + "dirs", + "serde", + "serde_json", + "shellexpand", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "libc" +version = "0.2.174" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" + +[[package]] +name = "libredox" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1580801010e535496706ba011c15f8532df6b42297d2e471fec38ceadd8c0638" +dependencies = [ + "bitflags", + "libc", +] + +[[package]] +name = "memchr" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "shellexpand" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b1fdf65dd6331831494dd616b30351c38e96e45921a27745cf98490458b90bb" +dependencies = [ + "dirs", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..7224e63 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "ionian-find" +version = "0.1.0" +edition = "2024" + +[dependencies] +clap = { version = "4.5.4", features = ["derive"] } +dirs = "5.0.1" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +shellexpand = "3.1.0" diff --git a/src/config/mod.rs b/src/config/mod.rs new file mode 100644 index 0000000..4d7878a --- /dev/null +++ b/src/config/mod.rs @@ -0,0 +1,31 @@ +use serde::{Deserialize, Serialize}; +use std::fs; +use std::path::PathBuf; + +#[derive(Serialize, Deserialize, Debug)] +pub struct Config { + pub explorer: Option, + pub base_path: Option, +} + +pub fn get_config_path() -> Result { + let config_dir = dirs::config_dir().ok_or_else(|| "Could not find config dir".to_string())?; + let app_config_dir = config_dir.join("ionian-find"); + fs::create_dir_all(&app_config_dir) + .map_err(|e| format!("Could not create config dir: {}", e))?; + Ok(app_config_dir.join("config.json")) +} + +pub fn load_config() -> Result { + let config_path = get_config_path()?; + let content = fs::read_to_string(config_path) + .map_err(|e| format!("Could not read config file: {}", e))?; + serde_json::from_str(&content).map_err(|e| format!("Could not parse config file: {}", e)) +} + +pub fn save_config(config: &Config) -> Result<(), String> { + let config_path = get_config_path()?; + let content = serde_json::to_string_pretty(config) + .map_err(|e| format!("Could not serialize config: {}", e))?; + fs::write(config_path, content).map_err(|e| format!("Could not write config file: {}", e)) +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..d65a833 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,111 @@ +use clap::{Parser, Subcommand}; +use std::path::PathBuf; +use std::process::Command; + +mod platform; +mod config; + +#[derive(Parser)] +#[command(author, version, about, long_about = None)] +struct Cli { + #[command(subcommand)] + command: Commands, +} + +#[derive(Subcommand)] +enum Commands { + /// Register the deep link to execute this app. + Register, + /// Unregister the deep link. + Unregister, + /// Open a file explorer to the given path. + Open { path: String }, + /// Set the file explorer and base path. + /// The explorer must be an executable in your PATH. + Setting { + #[arg(short, long)] + explorer: Option, + #[arg(short, long)] + base_path: Option, + }, +} + +fn main() { + let cli = Cli::parse(); + + let result = match &cli.command { + Commands::Register => platform::handle_register(), + Commands::Unregister => platform::handle_unregister(), + Commands::Open { path } => handle_open(path), + Commands::Setting { explorer, base_path } => handle_setting(explorer, base_path), + }; + + if let Err(e) = result { + eprintln!("Error: {}", e); + } +} + +fn handle_open(path: &str) -> Result<(), String> { + let config = config::load_config().unwrap_or_else(|_| config::Config { + explorer: None, + base_path: None, + }); + + let path_without_scheme = path.strip_prefix("ionian-find:").unwrap_or(path); + let relative_path = path_without_scheme.trim_start_matches('/'); + + let mut full_path = PathBuf::new(); + if let Some(base_path) = &config.base_path { + full_path.push(shellexpand::tilde(base_path).as_ref()); + } + full_path.push(relative_path); + + println!("Opening the file explorer to: {:?}", full_path); + + let explorer = config.explorer.unwrap_or_else(|| "xdg-open".to_string()); + + Command::new(explorer) + .arg(full_path) + .output() + .map_err(|e| format!("Failed to execute file explorer: {}", e))?; + + Ok(()) +} + +fn handle_setting(explorer: &Option, base_path: &Option) -> Result<(), String> { + let mut config = config::load_config().unwrap_or_else(|_| config::Config { + explorer: None, + base_path: None, + }); + // config should be saved only if at least one setting is provided + // If no settings are provided, print the current configuration + // and do not save the config. + // TODO: config guard like ```rust + // defer { + // config::save_config(&config); + // }``` + // This is possible with the `defer` crate, but not in the standard library. + // https://crates.io/crates/defer + + let mut isSet = false; + if let Some(explorer) = explorer { + println!("Setting the file explorer to: {}", explorer); + config.explorer = Some(explorer.clone()); + isSet = true; + } + if let Some(base_path) = base_path { + println!("Setting the base path to: {}", base_path); + config.base_path = Some(base_path.clone()); + isSet = true; + } + if !isSet { + // If no settings were provided, print the current configuration + println!("Current configuration:"); + println!("Explorer: {:?}", config.explorer.unwrap_or("Not set".into())); + println!("Base Path: {:?}", config.base_path.unwrap_or("Not set".into())); + return Ok(()); + } + else { + config::save_config(&config) + } +} diff --git a/src/platform/linux.rs b/src/platform/linux.rs new file mode 100644 index 0000000..c493a02 --- /dev/null +++ b/src/platform/linux.rs @@ -0,0 +1,81 @@ +use std::env; +use std::fs; + +use std::process::Command; + +pub fn handle_register() -> Result<(), String> { + println!("Registering the deep link for Linux..."); + + let exe_path = env::current_exe().map_err(|e| format!("Error getting current executable path: {}", e))?; + + let desktop_entry = format!( + "[Desktop Entry]\n\ + Type=Application\n\ + Name=Ionian Find\n\ + Exec={} open %u\n\ + StartupNotify=false\n\ + MimeType=x-scheme-handler/ionian-find;\n", + exe_path.to_str().unwrap_or("") + ); + + let data_local_dir = dirs::data_local_dir().ok_or("Could not find local data directory.")?; + + let app_dir = data_local_dir.join("applications"); + fs::create_dir_all(&app_dir).map_err(|e| format!("Error creating directory: {}", e))?; + + let desktop_file_path = app_dir.join("ionian-find.desktop"); + + fs::write(&desktop_file_path, desktop_entry).map_err(|e| format!("Error writing desktop file: {}", e))?; + + // Update the desktop database + Command::new("update-desktop-database") + .arg(app_dir.to_str().unwrap()) + .output() + .map_err(|e| format!("Failed to execute update-desktop-database: {}", e))?; + + let output = Command::new("xdg-mime") + .args(&[ + "default", + "ionian-find.desktop", + "x-scheme-handler/ionian-find", + ]) + .output() + .map_err(|e| format!("Failed to execute xdg-mime: {}", e))?; + + if output.status.success() { + println!("Deep link registered successfully!"); + } else { + return Err(format!( + "Error registering deep link: {}\n{}", + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr) + )); + } + + Ok(()) +} + +pub fn handle_unregister() -> Result<(), String> { + println!("Unregistering the deep link for Linux..."); + + let output = Command::new("xdg-mime") + .args(&[ + "default", + "org.gnome.Nautilus.desktop", + "x-scheme-handler/ionian-find", + ]) + .output() + .map_err(|e| format!("Failed to execute xdg-mime: {}", e))?; + + if output.status.success() { + println!("Deep link unregistered successfully!"); + } else { + return Err(format!( + "Error unregistering deep link: {}\n{}", + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr) + )); + } + + Ok(()) +} diff --git a/src/platform/mod.rs b/src/platform/mod.rs new file mode 100644 index 0000000..3df281d --- /dev/null +++ b/src/platform/mod.rs @@ -0,0 +1,18 @@ +pub mod linux; +pub mod windows; + +#[cfg(target_os = "linux")] +pub use linux::*; + +#[cfg(target_os = "windows")] +pub use windows::*; + +#[cfg(not(any(target_os = "linux", target_os = "windows")))] +pub fn handle_register() -> Result<(), String> { + unimplemented!("Register is not yet implemented for this OS."); +} + +#[cfg(not(any(target_os = "linux", target_os = "windows")))] +pub fn handle_unregister() -> Result<(), String> { + unimplemented!("Unregister is not yet implemented for this OS."); +} diff --git a/src/platform/windows.rs b/src/platform/windows.rs new file mode 100644 index 0000000..378414c --- /dev/null +++ b/src/platform/windows.rs @@ -0,0 +1,7 @@ +pub fn handle_register() -> Result<(), String> { + unimplemented!("Register is not yet implemented for Windows."); +} + +pub fn handle_unregister() -> Result<(), String> { + unimplemented!("Unregister is not yet implemented for Windows."); +}