Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,15 @@ protected Map<String, String> getConfigurations() {
/// Returns the native library directory selected by the launch options.
private Path getNativeFolder() {
if (StringUtils.isBlank(options.getNativesDir())) {
return repository.getNativeDirectory(manifest.id(), options.getJava().getPlatform());
Path defaultPath = repository.getNativeDirectory(manifest.id(), options.getJava().getPlatform());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

我不懂你为什么要改这里?而且既不检查 Java 版本,也不检查游戏版本,也不考多个仓库中相同实例 ID 发生冲突,就是强行把 native directory 修改掉。

// JDK 17+ uses the ANSI-native LoadLibraryA internally,
// which cannot resolve native libraries from non-ASCII paths.
// Use a temp directory with ASCII-only path as a workaround.
if (!StringUtils.isASCII(defaultPath.toString())) {
return Paths.get(System.getProperty("java.io.tmpdir"),
"hmcl-natives-" + Math.abs(manifest.id().id().hashCode()) + "-" + options.getJava().getPlatform());
}
return defaultPath;
}

return Path.of(options.getNativesDir());
Expand Down