Skip to content

Commit

Permalink
Revert windows fix (breaks gradle)
Browse files Browse the repository at this point in the history
  • Loading branch information
costin committed Jun 4, 2024
1 parent e4c7cd3 commit c6f1e1a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ public static String getTestLibraryPath(String nativeLibsDir) {
String platform = String.format(Locale.ROOT, "%s-%s", ElasticsearchDistribution.CURRENT_PLATFORM, arch);
String existingLibraryPath = System.getProperty("java.library.path");

//return String.format(Locale.ROOT, "%s/%s%c%s", nativeLibsDir, platform, File.pathSeparatorChar, existingLibraryPath);
String format = "%s/%s%c%s";
if (ElasticsearchDistribution.CURRENT_PLATFORM.equals(ElasticsearchDistribution.Platform.WINDOWS)) {
// windows doesn't like spaces in paths, so we must wrap the entire path in quotes to guard for it
format = "\"" + format + "\"";
}

return String.format(Locale.ROOT, format, nativeLibsDir, platform, File.pathSeparatorChar, existingLibraryPath);
return String.format(Locale.ROOT, "%s/%s%c%s", nativeLibsDir, platform, File.pathSeparatorChar, existingLibraryPath);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand Down Expand Up @@ -158,14 +157,10 @@ private static String findLibraryPath(Map<String, String> sysprops) {
String existingPath = sysprops.get("java.library.path");
assert existingPath != null;

String format = "%s%c%s";

String osname = sysprops.get("os.name");
String os;
if (osname.startsWith("Windows")) {
os = "windows";
// windows doesn't like spaces in paths, so we must wrap the entire path in quotes to guard for it
format = "\"" + format + "\"";
} else if (osname.startsWith("Linux")) {
os = "linux";
} else if (osname.startsWith("Mac OS")) {
Expand All @@ -182,13 +177,11 @@ private static String findLibraryPath(Map<String, String> sysprops) {
} else {
arch = "unsupported_arch[" + archname + "]";
}
String esPlatformDir = platformDir.resolve(os + "-" + arch).toAbsolutePath().toString();
return String.format(Locale.ROOT, format, esPlatformDir, getPathSeparator(), existingPath);
//return platformDir.resolve(os + "-" + arch).toAbsolutePath() + getPathSeparator() + existingPath;
return platformDir.resolve(os + "-" + arch).toAbsolutePath() + getPathSeparator() + existingPath;
}

@SuppressForbidden(reason = "no way to get path separator with nio")
private static char getPathSeparator() {
return File.pathSeparatorChar;
private static String getPathSeparator() {
return File.pathSeparator;
}
}

0 comments on commit c6f1e1a

Please sign in to comment.