95 return files; 96 } 97 98 public void addResource(File baseDir, String path) { 99 addResource(baseDir, new File(baseDir, path)); 100 } 101 102 public void addResource(File baseDir, File file) { 103 // normalize initial file 104 // to strip things like "." in the path 105 // or it can confuse symlink detection logic 106 file = file.getAbsoluteFile(); 107 108 if (baseDir == null) { 109 baseDir = file.getParentFile(); 110 } 111 resources.add(new RelativeFileSet( 112 baseDir, new LinkedHashSet<>(expandFileset(file)))); 113 } 114 115 void setClasspath() { 116 String classpath = ""; 117 for (RelativeFileSet resource : resources) { 118 for (String file : resource.getIncludedFiles()) { 119 if (file.endsWith(".jar")) { 120 classpath += file + File.pathSeparator; 121 } 122 } 123 } 124 addBundleArgument( 125 StandardBundlerParam.CLASSPATH.getID(), classpath); 126 } 127 128 static void validateName(String s, boolean forApp) 129 throws PackagerException { 130 131 String exceptionKey = forApp ? 132 "ERR_InvalidAppName" : "ERR_InvalidSLName"; 133 134 if (s == null) { 135 if (forApp) { 136 return; 137 } else { 138 throw new PackagerException(exceptionKey, s); 139 } 140 } | 95 return files; 96 } 97 98 public void addResource(File baseDir, String path) { 99 addResource(baseDir, new File(baseDir, path)); 100 } 101 102 public void addResource(File baseDir, File file) { 103 // normalize initial file 104 // to strip things like "." in the path 105 // or it can confuse symlink detection logic 106 file = file.getAbsoluteFile(); 107 108 if (baseDir == null) { 109 baseDir = file.getParentFile(); 110 } 111 resources.add(new RelativeFileSet( 112 baseDir, new LinkedHashSet<>(expandFileset(file)))); 113 } 114 115 void setClasspath(String mainJarPath) { 116 String classpath; 117 // we want main jar first on the classpath 118 if (mainJarPath != null) { 119 classpath = mainJarPath + File.pathSeparator; 120 } else { 121 classpath = ""; 122 } 123 for (RelativeFileSet resource : resources) { 124 for (String file : resource.getIncludedFiles()) { 125 if (file.endsWith(".jar")) { 126 if (!file.equals(mainJarPath)) { 127 classpath += file + File.pathSeparator; 128 } 129 } 130 } 131 } 132 addBundleArgument( 133 StandardBundlerParam.CLASSPATH.getID(), classpath); 134 } 135 136 static void validateName(String s, boolean forApp) 137 throws PackagerException { 138 139 String exceptionKey = forApp ? 140 "ERR_InvalidAppName" : "ERR_InvalidSLName"; 141 142 if (s == null) { 143 if (forApp) { 144 return; 145 } else { 146 throw new PackagerException(exceptionKey, s); 147 } 148 } |