Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bp3d-os"
version = "2.2.0"
version = "2.2.1"
authors = ["Yuri Edward <yuri6037@outlook.com>"]
edition = "2021"
description = "Operating System tools designed for BlockProject3D"
Expand Down
4 changes: 2 additions & 2 deletions core/src/assets/apple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ pub fn get_exe_path() -> Option<PathBuf> {
return None;
}
let str = OsStr::from_bytes(std::mem::transmute(&v[..size as usize]));
return Some(PathBuf::from(str));
return PathBuf::from(str).parent().map(|v| v.into());
}
if res != 0 {
return None;
}
let len = strlen(buf.as_ptr());
let str = OsStr::from_bytes(std::mem::transmute(&buf[..len]));
Some(PathBuf::from(str))
PathBuf::from(str).parent().map(|v| v.into())
}
}

Expand Down
9 changes: 6 additions & 3 deletions core/src/assets/bsd.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023, BlockProject 3D
// Copyright (c) 2025, BlockProject 3D
//
// All rights reserved.
//
Expand Down Expand Up @@ -56,10 +56,13 @@ pub fn get_exe_path() -> Option<PathBuf> {
//This is where we defer from process_path: we use std::os::unix::ffi::OsStrExt.
let str = OsStr::from_bytes(&buf[..len]);
let path = PathBuf::from(str);
Some(path)
path.parent().map(|v| v.into())
} else {
//FreeBSD with procfs.
std::fs::read_link("/proc/curproc/file").ok()
std::fs::read_link("/proc/curproc/file")
.ok()
.map(|v| v.parent().map(PathBuf::from))
.flatten()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/assets/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub fn get_exe_path() -> Option<PathBuf> {
}
//We finally found the executable file name!
let str1 = OsString::from_wide(&buf[..res as usize]);
Some(str1.into())
Some(PathBuf::from(str1).parent()?.into())
}
}

Expand Down
2 changes: 1 addition & 1 deletion module_test/test_mod/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ crate-type = ["rlib", "cdylib"]
bp3d-os-build = { version = "1.1.0", path = "../../build" }

[dependencies]
bp3d-os = { version = "2.2.0", path = "../../core", features = ["module"] }
bp3d-os = { version = "2.2.1", path = "../../core", features = ["module"] }
bp3d-debug = "1.0.0"
2 changes: 1 addition & 1 deletion module_test/testbin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ edition = "2024"
publish = false

[dependencies]
bp3d-os = { version = "2.2.0", path = "../../core", features = ["module"] }
bp3d-os = { version = "2.2.1", path = "../../core", features = ["module"] }
2 changes: 1 addition & 1 deletion shelltestbin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ edition = "2024"
publish = false

[dependencies]
bp3d-os = { version = "2.2.0", path = "../core", features = ["shell"] }
bp3d-os = { version = "2.2.1", path = "../core", features = ["shell"] }