Skip to content

Commit

Permalink
add install
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger-luo committed Jan 26, 2023
1 parent 3f3ee9a commit 2dedcea
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions src/ion/utils/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub fn normalize_path(path: &Path) -> PathBuf {
ret
}

#[cfg(debug_assertions)]
pub fn resources_dir() -> Result<PathBuf> {
Ok(std::env::current_exe()?
.parent()
Expand All @@ -38,6 +39,13 @@ pub fn resources_dir() -> Result<PathBuf> {
.join("resources"))
}

#[cfg(not(debug_assertions))]
pub fn resources_dir() -> Result<PathBuf> {
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<PathBuf> {
let path = resources_dir()?;
Ok(path.join("components"))
Expand Down

0 comments on commit 2dedcea

Please sign in to comment.