diff --git a/justfile b/justfile index b1056f0..7257755 100644 --- a/justfile +++ b/justfile @@ -17,3 +17,12 @@ delete-release tag: release tag: gh release create {{tag}} -t {{tag}} --generate-notes -p + + +[macos] +install: + cargo build --bin ion --release + mkdir -p $HOME/.local/bin + cp target/release/ion $HOME/.local/bin + mkdir -p $HOME/Library/Application\ Support/ion + cp -r resources $HOME/Library/Application\ Support/ion/resources diff --git a/src/ion/utils/paths.rs b/src/ion/utils/paths.rs index eeb4479..61a4a9e 100644 --- a/src/ion/utils/paths.rs +++ b/src/ion/utils/paths.rs @@ -29,6 +29,7 @@ pub fn normalize_path(path: &Path) -> PathBuf { ret } +#[cfg(debug_assertions)] pub fn resources_dir() -> Result { Ok(std::env::current_exe()? .parent() @@ -38,6 +39,13 @@ pub fn resources_dir() -> Result { .join("resources")) } +#[cfg(not(debug_assertions))] +pub fn resources_dir() -> Result { + let path = dirs::config_dir().expect("Could not find the config directory"); + let ion_dir = path.join("ion"); + Ok(ion_dir.join("resources")) +} + pub fn components_dir() -> Result { let path = resources_dir()?; Ok(path.join("components"))