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

Fail if the legacyClassPath.file does not exist #14

Merged
merged 1 commit into from
Dec 28, 2023
Merged
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
15 changes: 6 additions & 9 deletions src/main/java/cpw/mods/bootstraplauncher/BootstrapLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package cpw.mods.bootstraplauncher;

import cpw.mods.cl.JarModuleFinder;
import cpw.mods.cl.ModularURLHandler;
import cpw.mods.cl.ModuleClassLoader;
import cpw.mods.jarhandling.SecureJar;

Expand Down Expand Up @@ -183,19 +182,17 @@ private static List<String> loadLegacyClassPath() {

if (legacyCpPath != null) {
var legacyCPFileCandidatePath = Paths.get(legacyCpPath);
if (Files.exists(legacyCPFileCandidatePath) && Files.isRegularFile(legacyCPFileCandidatePath)) {
try {
return Files.readAllLines(legacyCPFileCandidatePath);
}
catch (IOException e) {
throw new IllegalStateException("Failed to load the legacy class path from the specified file: " + legacyCpPath, e);
}
try {
return Files.readAllLines(legacyCPFileCandidatePath);
}
catch (IOException e) {
throw new IllegalStateException("Failed to load the legacy class path from the specified file: " + legacyCpPath, e);
}
}

var legacyClasspath = System.getProperty("legacyClassPath", System.getProperty("java.class.path"));
Objects.requireNonNull(legacyClasspath, "Missing legacyClassPath, cannot bootstrap");
if (legacyClasspath.length() == 0) {
if (legacyClasspath.isEmpty()) {
return List.of();
} else {
return Arrays.asList(legacyClasspath.split(File.pathSeparator));
Expand Down