< prev index next >

src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java

Print this page




 194 
 195         this.params = config;
 196         this.root = imageOutDir.resolve(jreName );
 197         this.contentsDir = root.resolve("Contents");
 198         this.javaDir = null;
 199         this.javaModsDir = null;
 200         this.resourcesDir = null;
 201         this.macOSDir = null;
 202         this.runtimeDir = this.root;
 203         this.runtimeRoot = runtimeDir.resolve("Contents/Home");
 204         this.mdir = runtimeRoot.resolve("lib");
 205 
 206         Files.createDirectories(runtimeDir);
 207     }
 208 
 209     private void writeEntry(InputStream in, Path dstFile) throws IOException {
 210         Files.createDirectories(dstFile.getParent());
 211         Files.copy(in, dstFile);
 212     }
 213 
 214     // chmod ugo+x file
 215     private void setExecutable(Path file) {
 216         try {
 217             Set<PosixFilePermission> perms =
 218                     Files.getPosixFilePermissions(file);
 219             perms.add(PosixFilePermission.OWNER_EXECUTE);
 220             perms.add(PosixFilePermission.GROUP_EXECUTE);
 221             perms.add(PosixFilePermission.OTHERS_EXECUTE);
 222             Files.setPosixFilePermissions(file, perms);
 223         } catch (IOException ioe) {
 224             throw new UncheckedIOException(ioe);
 225         }
 226     }
 227 
 228     private static void createUtf8File(File file, String content)
 229         throws IOException {
 230         try (OutputStream fout = new FileOutputStream(file);
 231              Writer output = new OutputStreamWriter(fout, "UTF-8")) {
 232             output.write(content);
 233         }
 234     }
 235 
 236     public static boolean validCFBundleVersion(String v) {
 237         // CFBundleVersion (String - iOS, OS X) specifies the build version
 238         // number of the bundle, which identifies an iteration (released or
 239         // unreleased) of the bundle. The build version number should be a
 240         // string comprised of three non-negative, period-separated integers
 241         // with the first integer being greater than zero. The string should
 242         // only contain numeric (0-9) and period (.) characters. Leading zeros
 243         // are truncated from each integer and will be ignored (that is,
 244         // 1.02.3 is equivalent to 1.2.3). This key is not localizable.
 245 
 246         if (v == null) {
 247             return false;
 248         }
 249 
 250         String p[] = v.split("\\.");
 251         if (p.length > 3 || p.length < 1) {
 252             Log.verbose(I18N.getString(
 253                     "message.version-string-too-many-components"));
 254             return false;
 255         }




 194 
 195         this.params = config;
 196         this.root = imageOutDir.resolve(jreName );
 197         this.contentsDir = root.resolve("Contents");
 198         this.javaDir = null;
 199         this.javaModsDir = null;
 200         this.resourcesDir = null;
 201         this.macOSDir = null;
 202         this.runtimeDir = this.root;
 203         this.runtimeRoot = runtimeDir.resolve("Contents/Home");
 204         this.mdir = runtimeRoot.resolve("lib");
 205 
 206         Files.createDirectories(runtimeDir);
 207     }
 208 
 209     private void writeEntry(InputStream in, Path dstFile) throws IOException {
 210         Files.createDirectories(dstFile.getParent());
 211         Files.copy(in, dstFile);
 212     }
 213 






















 214     public static boolean validCFBundleVersion(String v) {
 215         // CFBundleVersion (String - iOS, OS X) specifies the build version
 216         // number of the bundle, which identifies an iteration (released or
 217         // unreleased) of the bundle. The build version number should be a
 218         // string comprised of three non-negative, period-separated integers
 219         // with the first integer being greater than zero. The string should
 220         // only contain numeric (0-9) and period (.) characters. Leading zeros
 221         // are truncated from each integer and will be ignored (that is,
 222         // 1.02.3 is equivalent to 1.2.3). This key is not localizable.
 223 
 224         if (v == null) {
 225             return false;
 226         }
 227 
 228         String p[] = v.split("\\.");
 229         if (p.length > 3 || p.length < 1) {
 230             Log.verbose(I18N.getString(
 231                     "message.version-string-too-many-components"));
 232             return false;
 233         }


< prev index next >