Просмотр исходного кода

wallet: set the current working directory to the same folder as the binary for distribution as a .zip file

darkfi 1 год назад
Родитель
Сommit
ebb7d56213
2 измененных файлов с 8 добавлено и 0 удалено
  1. 2 0
      bin/darkwallet/Makefile
  2. 6 0
      bin/darkwallet/src/main.rs

+ 2 - 0
bin/darkwallet/Makefile

@@ -1,5 +1,7 @@
 default: fonts
 	cargo lrun
+	mv target/debug/darkwallet .
+	./darkwallet
 
 ibm-plex-mono-regular.otf:
 	wget https://codeberg.org/darkrenaissance/darkfi/raw/branch/data/ibm-plex-mono-regular.otf

+ 6 - 0
bin/darkwallet/src/main.rs

@@ -102,8 +102,14 @@ fn main() {
         }
     }
 
+    let exe_path = std::env::current_exe().unwrap();
+    let basename = exe_path.parent().unwrap();
+    std::env::set_current_dir(basename);
+
     info!("Target OS: {}", build_info::TARGET_OS);
     info!("Target arch: {}", build_info::TARGET_ARCH);
+    let cwd = std::env::current_dir().unwrap();
+    info!("Current dir: {}", cwd.display());
 
     let ex = Arc::new(smol::Executor::new());
     let sg_root = SceneNode3::root();