Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c9802e6 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Fix maketext tool to work correctly on darwin-x86

Bug: 6661783
Bug: 6662536
Change-Id: I5e657975098a0630ceb1821053cda68bf481d2e4
parent 9ada9f1b
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -27,14 +27,13 @@ import java.util.jar.JarEntry;
import java.util.jar.JarFile;

public class JarUtils {
    private static final String MANIFEST = "META-INF/MANIFEST.MF";

    private JarUtils() {
        // This utility class is not publicly instantiable.
    }

    public static JarFile getJarFile(final ClassLoader loader) {
        final URL resUrl = loader.getResource(MANIFEST);
    public static JarFile getJarFile(final Class<?> mainClass) {
        final String mainClassPath = "/" + mainClass.getName().replace('.', '/') + ".class";
        final URL resUrl = mainClass.getResource(mainClassPath);
        if (!resUrl.getProtocol().equals("jar")) {
            throw new RuntimeException("Should run as jar");
        }
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ public class LabelText {

    public static void main(final String[] args) {
        final Options options = new Options(args);
        final JarFile jar = JarUtils.getJarFile(LabelText.class.getClassLoader());
        final JarFile jar = JarUtils.getJarFile(LabelText.class);
        final MoreKeysResources resources = new MoreKeysResources(jar);
        resources.writeToJava(options.mJava);
    }
+1 −1
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ public class MoreKeysResources {
                final File outputFile = new File(outPackage,
                        JAVA_TEMPLATE.replace(".tmpl", ".java"));
                outPackage.mkdirs();
                ps = new PrintStream(outputFile);
                ps = new PrintStream(outputFile, "UTF-8");
            }
            lnr = new LineNumberReader(new InputStreamReader(JarUtils.openResource(template)));
            inflateTemplate(lnr, ps);