Skip to content
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

Classpath separator on linux is different from windows #4

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

elijah629
Copy link

On Linux systems, the java classpath separator is a colon instead of a semicolon. I have used conditional compilation to set the separator based on the compilation target.

src/classpath.rs Outdated
Comment on lines 16 to 20
#[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 = ';';

@DeityLamb
Copy link

I think it's worth fixing as well

let fixed_lib_path = Path::new(&libraries_path).join(lib_path.replace("/", "\\"));

@John71-Off
Copy link

Yes, code should be :

let fixed_lib_path = Path::new(&libraries_path).join(lib_path.replace("\\", "/"));

or

let fixed_lib_path = Path::new(&libraries_path).join(lib_path);

as / is a path separator that works for Linux, MacOS and Windows ;
I don't think that \\ works for OSes other than Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants