Skip to content

Commit

Permalink
Fix cleanup on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyasm-dev committed Jul 24, 2023
1 parent e361a36 commit 2ec544b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "jnat"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
license = "MIT"
description = "A wrapper around the jni crate"
Expand Down
15 changes: 14 additions & 1 deletion integration/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ static DYLIB_EXTENSION: &str = "so";
#[cfg(target_os = "windows")]
static DYLIB_EXTENSION: &str = "dll";

// TODO: Ensure this works correctly
fn get_dylib_name(lib: &str) -> String {
#[cfg(target_os = "windows")]
return format!("{}.{}", lib, DYLIB_EXTENSION);
format!("lib{}.{}", lib, DYLIB_EXTENSION)
}

Expand Down Expand Up @@ -172,6 +173,18 @@ fn main() {

remove_file(Path::new("out").join(format!("{}.class", t.java_class)))
.expect(format!("Failed to remove {}.class", t.java_class).as_str());

#[cfg(target_os = "windows")]
{
remove_file(Path::new("out").join(format!("{}.exp", get_dylib_name(t.lib))))
.expect(format!("Failed to remove {}.lib", get_dylib_name(t.lib)).as_str());

remove_file(Path::new("out").join(format!("{}.lib", get_dylib_name(t.lib))))
.expect(format!("Failed to remove {}.lib", get_dylib_name(t.lib)).as_str());

remove_file(Path::new("out").join(format!("{}.pdb", t.lib)))
.expect(format!("Failed to remove {}.pdb", t.lib).as_str());
}
}

teardown();
Expand Down

0 comments on commit 2ec544b

Please sign in to comment.