Skip to content

Commit f05087c

Browse files
committed
Fix resource paths that Makepad expects
Cleanup verbose output in moxin-runner
1 parent ca0d403 commit f05087c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

moxin-runner/src/main.rs

-2
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,6 @@ fn run_moxin(_main_wasmedge_dylib_dir: Option<&Path>) -> std::io::Result<()> {
448448
#[cfg(windows)] {
449449
match (std::env::var_os(ENV_PATH), _main_wasmedge_dylib_dir) {
450450
(Some(path), Some(dylib_parent)) => {
451-
println!("Old path: {:?}", path.to_string_lossy());
452451
println!("Prepending \"{}\" to Windows PATH", dylib_parent.display());
453452
let new_path = std::env::join_paths(
454453
Some(dylib_parent.to_path_buf())
@@ -457,7 +456,6 @@ fn run_moxin(_main_wasmedge_dylib_dir: Option<&Path>) -> std::io::Result<()> {
457456
)
458457
.expect("BUG: failed to join paths for the main Moxin binary.");
459458
std::env::set_var(ENV_PATH, &new_path);
460-
println!("New path: {:?}", std::env::var(ENV_PATH));
461459

462460
}
463461
_ => eprintln!("BUG: failed to set PATH for the main Moxin binary."),

packaging/before-packaging-command/src/main.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,16 @@ use cargo_metadata::MetadataCommand;
4545
/// which is currently `/usr/lib/moxin-runner`.
4646
/// * This is the directory in which `dpkg` copies app resource files to
4747
/// when a user installs the `.deb` package.
48+
/// * For Windows NSIS packages, this should be set to `.` (the current dir).
49+
/// * This is because the NSIS installer script copies the resources to the same directory
50+
/// as the installed binaries, and our `moxin-runner` app changes the current working directory
51+
/// to that same directory before running the main Moxin binary.
4852
fn makepad_package_dir_value(package_format: &str) -> &'static str {
4953
match package_format {
5054
"app" | "dmg" => "../Resources",
5155
"appimage" => "../../usr/lib/moxin",
5256
"deb" | "pacman" => "/usr/share/moxin",
53-
"nsis" => ".\\",
57+
"nsis" => ".",
5458
_other => panic!("Unsupported package format: {}", _other),
5559
}
5660
}
@@ -103,9 +107,9 @@ fn before_packaging(host_os: &str) -> std::io::Result<()> {
103107
let dist_resources_dir = cwd.join("dist").join("resources");
104108
fs::create_dir_all(&dist_resources_dir)?;
105109

106-
let moxin_resources_dest = dist_resources_dir.join("moxin");
110+
let moxin_resources_dest = dist_resources_dir.join("moxin").join("resources");
107111
let moxin_resources_src = cwd.join("resources");
108-
let makepad_widgets_resources_dest = dist_resources_dir.join("makepad_widgets");
112+
let makepad_widgets_resources_dest = dist_resources_dir.join("makepad_widgets").join("resources");
109113
let makepad_widgets_resources_src = {
110114
let cargo_metadata = MetadataCommand::new()
111115
.exec()

0 commit comments

Comments
 (0)