245 String appImage = (String)bundlerArguments.get( 246 Arguments.CLIOptions.PREDEFINED_APP_IMAGE.getId()); 247 if (appImage != null) { 248 File appImageDir = new File(appImage); 249 if (!appImageDir.exists() || appImageDir.list().length == 0) { 250 throw new PackagerException("ERR_AppImageNotExist", appImage); 251 } 252 } 253 254 // Validate temp dir 255 String root = (String)bundlerArguments.get( 256 Arguments.CLIOptions.TEMP_ROOT.getId()); 257 if (root != null) { 258 String [] contents = (new File(root)).list(); 259 260 if (contents != null && contents.length > 0) { 261 throw new PackagerException("ERR_BuildRootInvalid", root); 262 } 263 } 264 265 // Validate license file if set 266 String license = (String)bundlerArguments.get( 267 Arguments.CLIOptions.LICENSE_FILE.getId()); 268 if (license != null) { 269 File licenseFile = new File(license); 270 if (!licenseFile.exists()) { 271 throw new PackagerException("ERR_LicenseFileNotExit"); 272 } 273 } 274 } 275 276 void setTargetFormat(String t) { 277 targetFormat = t; 278 } 279 280 String getTargetFormat() { 281 return targetFormat; 282 } 283 284 boolean isTargetAppImage() { | 245 String appImage = (String)bundlerArguments.get( 246 Arguments.CLIOptions.PREDEFINED_APP_IMAGE.getId()); 247 if (appImage != null) { 248 File appImageDir = new File(appImage); 249 if (!appImageDir.exists() || appImageDir.list().length == 0) { 250 throw new PackagerException("ERR_AppImageNotExist", appImage); 251 } 252 } 253 254 // Validate temp dir 255 String root = (String)bundlerArguments.get( 256 Arguments.CLIOptions.TEMP_ROOT.getId()); 257 if (root != null) { 258 String [] contents = (new File(root)).list(); 259 260 if (contents != null && contents.length > 0) { 261 throw new PackagerException("ERR_BuildRootInvalid", root); 262 } 263 } 264 265 // Validate resource dir 266 String resources = (String)bundlerArguments.get( 267 Arguments.CLIOptions.RESOURCE_DIR.getId()); 268 if (resources != null) { 269 if (!(new File(resources)).exists()) { 270 throw new PackagerException( 271 "message.resource-dir-does-not-exist", 272 Arguments.CLIOptions.RESOURCE_DIR.getId(), resources); 273 } 274 } 275 276 // Validate predefined runtime dir 277 String runtime = (String)bundlerArguments.get( 278 Arguments.CLIOptions.PREDEFINED_RUNTIME_IMAGE.getId()); 279 if (runtime != null) { 280 if (!(new File(runtime)).exists()) { 281 throw new PackagerException( 282 "message.runtime-image-dir-does-not-exist", 283 Arguments.CLIOptions.PREDEFINED_RUNTIME_IMAGE.getId(), 284 runtime); 285 } 286 } 287 288 289 290 // Validate license file if set 291 String license = (String)bundlerArguments.get( 292 Arguments.CLIOptions.LICENSE_FILE.getId()); 293 if (license != null) { 294 File licenseFile = new File(license); 295 if (!licenseFile.exists()) { 296 throw new PackagerException("ERR_LicenseFileNotExit"); 297 } 298 } 299 } 300 301 void setTargetFormat(String t) { 302 targetFormat = t; 303 } 304 305 String getTargetFormat() { 306 return targetFormat; 307 } 308 309 boolean isTargetAppImage() { |