mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-13 06:17:46 +01:00
fix prop location of smali/baksmali, add more checks
This commit is contained in:
parent
a8f6e40c02
commit
d07f52bd6a
@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
package brut.androlib;
|
package brut.androlib;
|
||||||
|
|
||||||
|
import org.jf.baksmali.baksmali;
|
||||||
|
import org.jf.smali.main;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
@ -37,8 +40,7 @@ public class ApktoolProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void loadProps() {
|
private static void loadProps() {
|
||||||
InputStream in = ApktoolProperties.class
|
InputStream in = ApktoolProperties.class.getResourceAsStream("/properties/apktool.properties");
|
||||||
.getResourceAsStream("/properties/apktool.properties");
|
|
||||||
sProps = new Properties();
|
sProps = new Properties();
|
||||||
try {
|
try {
|
||||||
sProps.load(in);
|
sProps.load(in);
|
||||||
@ -47,25 +49,31 @@ public class ApktoolProperties {
|
|||||||
LOGGER.warning("Can't load properties.");
|
LOGGER.warning("Can't load properties.");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStream templateStream = ApktoolProperties.class
|
InputStream templateStream = baksmali.class.getClassLoader().getResourceAsStream("baksmali.properties");
|
||||||
.getResourceAsStream("/properties/baksmali.properties");
|
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
String version = "(unknown)";
|
String version = "(unknown)";
|
||||||
try {
|
|
||||||
properties.load(templateStream);
|
if (templateStream != null) {
|
||||||
version = properties.getProperty("application.version");
|
try {
|
||||||
} catch (IOException ex) {
|
properties.load(templateStream);
|
||||||
}
|
version = properties.getProperty("application.version");
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
sProps.put("baksmaliVersion", version);
|
sProps.put("baksmaliVersion", version);
|
||||||
templateStream = ApktoolProperties.class
|
|
||||||
.getResourceAsStream("/properties/smali.properties");
|
|
||||||
|
templateStream = main.class.getClassLoader().getResourceAsStream("smali.properties");
|
||||||
properties = new Properties();
|
properties = new Properties();
|
||||||
version = "(unknown)";
|
version = "(unknown)";
|
||||||
try {
|
|
||||||
properties.load(templateStream);
|
if (templateStream != null) {
|
||||||
version = properties.getProperty("application.version");
|
try {
|
||||||
} catch (IOException ex) {
|
properties.load(templateStream);
|
||||||
}
|
version = properties.getProperty("application.version");
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
sProps.put("smaliVersion", version);
|
sProps.put("smaliVersion", version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user