Use separate native folder for each platform
This commit is contained in:
@@ -36,6 +36,7 @@ import org.jackhuang.hmcl.util.Lang;
|
||||
import org.jackhuang.hmcl.util.ToStringBuilder;
|
||||
import org.jackhuang.hmcl.util.gson.JsonUtils;
|
||||
import org.jackhuang.hmcl.util.io.FileUtils;
|
||||
import org.jackhuang.hmcl.util.platform.Platform;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
@@ -154,8 +155,8 @@ public class DefaultGameRepository implements GameRepository {
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getNativeDirectory(String id) {
|
||||
return new File(getVersionRoot(id), "natives");
|
||||
public File getNativeDirectory(String id, Platform platform) {
|
||||
return new File(getVersionRoot(id), "natives-" + platform);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package org.jackhuang.hmcl.game;
|
||||
|
||||
import org.jackhuang.hmcl.task.Task;
|
||||
import org.jackhuang.hmcl.util.platform.Platform;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -123,9 +124,10 @@ public interface GameRepository extends VersionProvider {
|
||||
* always fail({@code UnsupportedOperationException}) and not to use it.
|
||||
*
|
||||
* @param id version id
|
||||
* @param platform the platform of native libraries
|
||||
* @return the native directory
|
||||
*/
|
||||
File getNativeDirectory(String id);
|
||||
File getNativeDirectory(String id, Platform platform);
|
||||
|
||||
/**
|
||||
* Get minecraft jar
|
||||
|
||||
@@ -356,7 +356,7 @@ public class DefaultLauncher extends Launcher {
|
||||
public ManagedProcess launch() throws IOException, InterruptedException {
|
||||
File nativeFolder = null;
|
||||
if (options.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) {
|
||||
nativeFolder = repository.getNativeDirectory(version.getId());
|
||||
nativeFolder = repository.getNativeDirectory(version.getId(), options.getJava().getPlatform());
|
||||
} else {
|
||||
nativeFolder = new File(options.getNativesDir());
|
||||
}
|
||||
@@ -431,7 +431,7 @@ public class DefaultLauncher extends Launcher {
|
||||
|
||||
File nativeFolder = null;
|
||||
if (options.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) {
|
||||
nativeFolder = repository.getNativeDirectory(version.getId());
|
||||
nativeFolder = repository.getNativeDirectory(version.getId(), options.getJava().getPlatform());
|
||||
} else {
|
||||
nativeFolder = new File(options.getNativesDir());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user