Skip to content

Commit 17419a3

Browse files
committed
Fix windows .so output directory. #14
1 parent 33a5cf0 commit 17419a3

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/BuildNativeLib.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.nmmedit.apkprotect;
22

33
import com.nmmedit.apkprotect.data.Prefs;
4+
import com.nmmedit.apkprotect.util.OsDetector;
45
import org.jetbrains.annotations.NotNull;
56

67
import java.io.*;
@@ -141,16 +142,16 @@ public String getStripBinaryPath() {
141142
switch (abi) {
142143
case "armeabi-v7a":
143144
return new File(getNdkHome(), "/toolchains/arm-linux-androideabi-4.9/prebuilt/" +
144-
Prefs.getOsName() + "/bin/arm-linux-androideabi-strip").getAbsolutePath();
145+
Prefs.osName() + "/bin/arm-linux-androideabi-strip").getAbsolutePath();
145146
case "arm64-v8a":
146147
return new File(getNdkHome(), "/toolchains/aarch64-linux-android-4.9/prebuilt/" +
147-
Prefs.getOsName() + "/bin/aarch64-linux-android-strip").getAbsolutePath();
148+
Prefs.osName() + "/bin/aarch64-linux-android-strip").getAbsolutePath();
148149
case "x86":
149150
return new File(getNdkHome(), "/toolchains/x86-4.9/prebuilt/" +
150-
Prefs.getOsName() + "/bin/i686-linux-android-strip").getAbsolutePath();
151+
Prefs.osName() + "/bin/i686-linux-android-strip").getAbsolutePath();
151152
case "x86_64":
152153
return new File(getNdkHome(), "/toolchains/x86_64-4.9/prebuilt/" +
153-
Prefs.getOsName() + "/bin/x86_64-linux-android-strip").getAbsolutePath();
154+
Prefs.osName() + "/bin/x86_64-linux-android-strip").getAbsolutePath();
154155
}
155156
//不支持arm和x86以外的abi
156157
throw new RuntimeException("Unsupported abi " + abi);
@@ -186,10 +187,18 @@ public List<String> getCmakeArguments() {
186187

187188
//最后输出的so文件
188189
public List<File> getSharedObjectFile() {
189-
return Arrays.asList(
190-
new File(getLibOutputDir(), "libnmmvm.so"),
191-
new File(getLibOutputDir(), "libnmmp.so")
192-
);
190+
if(OsDetector.isWindows()){
191+
return Arrays.asList(
192+
new File(getBuildPath(), "vm/libnmmvm.so"),
193+
new File(getBuildPath(), "libnmmp.so")
194+
);
195+
196+
}else {
197+
return Arrays.asList(
198+
new File(getLibOutputDir(), "libnmmvm.so"),
199+
new File(getLibOutputDir(), "libnmmp.so")
200+
);
201+
}
193202
}
194203

195204
public enum BuildType {

nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/data/Prefs.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ public static Config config() {
3333
String content = FileUtils.readFile(CONFIG_PATH, StandardCharsets.UTF_8);
3434
return gson.fromJson(content, Config.class);
3535
} catch (IOException e) {
36-
e.printStackTrace();
37-
return null;
36+
throw new RuntimeException("Load config failed", e);
3837
}
3938
}
4039

@@ -66,7 +65,7 @@ public static String ndkPath() {
6665
return config().path.ndk;
6766
}
6867

69-
public static String getOsName() {
68+
public static String osName() {
7069
return config().ndk.osName;
7170
}
7271
}

0 commit comments

Comments
 (0)