Skip to content

Classpath separator on linux is different from windows #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 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
9 changes: 8 additions & 1 deletion src/classpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ pub fn should_use_library(lib: &Library) -> bool {
return is_all_rules_satisfied(rules);
}


#[cfg(target_os = "linux")]
pub const CLASSPATH_SEP: char = ':';

#[cfg(not(target_os = "linux"))]
pub const CLASSPATH_SEP: char = ';';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Classpath separator for Windows is ;, for Linux and MacOS :

You should use :

#[cfg(not(target_os = "windows"))] // Linux and MacOS
pub const CLASSPATH_SEP: char = ':';

#[cfg(target_os = "windows")] // Windows
pub const CLASSPATH_SEP: char = ';';


pub fn create_classpath(
jar_file: PathBuf,
libraries_path: PathBuf,
Expand All @@ -25,7 +32,7 @@ pub fn create_classpath(
let artifact = &lib.downloads.artifact;
let lib_path = artifact.path.clone();
let fixed_lib_path = Path::new(&libraries_path).join(lib_path.replace("/", "\\"));
classpath = format!("{};{}", classpath, fixed_lib_path.to_str().unwrap());
classpath = format!("{}{}{}", classpath, CLASSPATH_SEP, fixed_lib_path.to_str().unwrap());
}
}

Expand Down