refactor(cli): use cargo manifest dir for resources in dev mode
ci/woodpecker/push/woodpecker Pipeline is running Details

feat/selector-improvements
Tomáš Mládek 2023-11-17 17:23:08 +01:00
parent 28861370a7
commit 46a1088d22
1 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
use std::env::current_exe;
use std::{env::current_exe, path::PathBuf};
use anyhow::{anyhow, Result};
use lazy_static::lazy_static;
@ -8,8 +8,8 @@ shadow!(build);
pub fn get_resource_path<S: AsRef<str>>(dir: S) -> Result<std::path::PathBuf> {
let base_path = if is_debug() {
let cwd = std::env::current_exe()?.parent().unwrap().to_path_buf();
cwd.join("../../tmp/resources")
let cwd = build::CARGO_MANIFEST_DIR.parse::<PathBuf>()?;
cwd.join("./tmp/resources")
} else {
current_exe()?
.parent()
@ -39,4 +39,4 @@ lazy_static! {
pub fn get_version() -> &'static str {
option_env!("UPEND_VERSION").unwrap_or("unknown")
}
}