List of usage examples for java.io File separatorChar
char separatorChar
To view the source code for java.io File separatorChar.
Click Source Link
From source file:abs.backend.erlang.ErlApp.java
private void copyRuntime() throws IOException { InputStream is = null;//from w w w . j a v a 2 s . c o m // TODO: this only works when the erlang compiler is invoked // from a jar file. See http://stackoverflow.com/a/2993908 on // how to handle the other case. URLConnection resource = getClass().getResource("").openConnection(); try { for (String f : RUNTIME_FILES) { if (f.endsWith("/*")) { String dirname = f.substring(0, f.length() - 2); String inname = RUNTIME_PATH + dirname; String outname = destDir + "/" + dirname; new File(outname).mkdirs(); if (resource instanceof JarURLConnection) { copyJarDirectory(((JarURLConnection) resource).getJarFile(), inname, outname); } else if (resource instanceof FileURLConnection) { /* stolz: This at least works for the unit tests from within Eclipse */ File file = new File("src"); assert file.exists(); FileUtils.copyDirectory(new File("src/" + RUNTIME_PATH), destDir); } else { throw new UnsupportedOperationException("File type: " + resource); } } else { is = ClassLoader.getSystemResourceAsStream(RUNTIME_PATH + f); if (is == null) throw new RuntimeException("Could not locate Runtime file:" + f); String outputFile = f.replace('/', File.separatorChar); File file = new File(destDir, outputFile); file.getParentFile().mkdirs(); ByteStreams.copy(is, Files.newOutputStreamSupplier(file)); } } } finally { if (is != null) is.close(); } for (String f : EXEC_FILES) { new File(destDir, f).setExecutable(true, false); } }
From source file:com.googlecode.gmaps4jsf.jsfplugin.mojo.BaseFacesMojo.java
protected String createPackageDirectory(String outputPath, Component component) { String basePackage = StringUtils.replaceChars(component.getPackage(), '.', File.separatorChar); String packagePath = outputPath + File.separator + basePackage; File packageDirectory = new File(packagePath); if (!packageDirectory.exists()) packageDirectory.mkdirs();//from ww w . j av a 2s.co m return packagePath; }
From source file:jvmoptions.OptionAnalyzer.java
static Map<String, Map<String, String>> parse(Path hpp) { System.out.printf("process %s %n", hpp); String file = hpp.subpath(4, hpp.getNameCount()).toString().replace(File.separatorChar, '/'); try {//from w w w .j a v a 2s.c o m String all = preprocess(hpp); String categories = "(?<kind>develop|develop_pd|product|product_pd|diagnostic|experimental|notproduct|manageable|product_rw|lp64_product)"; // detect Regex bugs. List<String> names = parseNames(all, categories); Set<String> nameSet = new HashSet<>(); Pattern descPtn = Pattern.compile("\"((\\\\\"|[^\"])+)\""); Pattern pattern = Pattern.compile(categories + "\\((?<type>\\w+?),[ ]*(?<name>\\w+)[ ]*(,[ ]*(?<default>[\\w ()\\-+/*.\"]+))?,[ ]*(?<desc>(" + descPtn.pattern() + "[ ]*)+)\\)"); Map<String, Map<String, String>> result = new HashMap<>(); int times = 0; for (Matcher matcher = pattern.matcher(all); matcher.find(); times++) { String name = matcher.group("name"); verify(names, nameSet, times, name); String def = Objects.toString(matcher.group("default"), ""); String d = matcher.group("desc"); StringBuilder desc = new StringBuilder(); for (Matcher m = descPtn.matcher(d); m.find();) { desc.append(m.group(1).replaceAll("\\\\", "")); } Map<String, String> m = new HashMap<>(); m.put("kind", matcher.group("kind")); m.put("type", matcher.group("type")); m.put("default", def); m.put("description", desc.toString()); m.put("file", file); result.put(name, m); } System.out.printf(" %s contains %d options%n", hpp, times); return result; } catch (IOException e) { throw new UncheckedIOException(e); } }
From source file:com.nridge.core.app.mgr.AppMgr.java
/** * Default constructor./*from www. j a v a 2 s. co m*/ */ public AppMgr() { mIsPathsExplicit = false; mIsAlive = new AtomicBoolean(true); mPropertyMap = new HashMap<String, Object>(); mInsPathName = System.getProperty("user.dir"); mCfgPathName = String.format("%s%ccfg", mInsPathName, File.separatorChar); mLogPathName = String.format("%s%clog", mInsPathName, File.separatorChar); mDSPathName = String.format("%s%cds", mInsPathName, File.separatorChar); mRDBMSPathName = String.format("%s%crdb", mInsPathName, File.separatorChar); mGraphPathName = String.format("%s%cgdb", mInsPathName, File.separatorChar); }
From source file:com.microsoft.tfs.core.clients.versioncontrol.localworkspace.IgnoreFile.java
/** * Add an exclude entry into IgnoreFile/* w w w .j a va2 s. c o m*/ * * @param directory * @param toReturn * @param pattern * @return */ private static void addExcludeEntry(final String directory, final IgnoreFile toReturn, String pattern) { try { if (pattern.length() > 0 && ((pattern.charAt(0) == '\ufeff') || (pattern.charAt(0) == '\ufffe'))) { pattern = pattern.substring(1); } pattern = pattern.trim(); if (pattern.length() > 0) { if (pattern.charAt(0) == c_commentPrefix || (pattern.charAt(0) == '\ufeff') && (pattern.length() > 1 && pattern.charAt(1) == c_commentPrefix)) { return; } // Convert forward and backslashes to native pattern = pattern.replace("/", File.separator); //$NON-NLS-1$ pattern = pattern.replace("\\", File.separator); //$NON-NLS-1$ boolean isExcluded = true; boolean isRecursive = true; boolean isFolderOnly = false; if (pattern.charAt(0) == c_includePrefix && pattern.length() > 1) { isExcluded = false; pattern = pattern.substring(1); } if (pattern.charAt(0) == File.separatorChar && pattern.length() > 1) { isRecursive = false; pattern = pattern.substring(1); } if (pattern.charAt(pattern.length() - 1) == File.separatorChar && pattern.length() > 1) { isFolderOnly = true; pattern = pattern.substring(0, pattern.length() - 1); } pattern = pattern.trim(); if (pattern.length() > 0) { toReturn.addEntry(new IgnoreEntry(LocalPath.combine(directory, pattern), isExcluded, isRecursive, isFolderOnly)); } } } catch (final Exception ex) { log.warn("Error parsing ignore file line", ex); //$NON-NLS-1$ } }
From source file:org.openmeetings.test.AbstractOpenmeetingsSpringTest.java
private void makeDefaultScheme() throws Exception { String filePath = System.getProperty("webapps.root") + File.separatorChar + ScopeApplicationAdapter.webAppPath + ImportInitvalues.languageFolderName; importInitvalues.loadAll(filePath, new InstallationConfig(), username, userpass, useremail, orgname, timeZone, false);//from w w w.j a v a 2 s. co m }
From source file:com.safi.workshop.application.ChooseSafiServerWorkspaceData.java
/** * Set this data's initialDefault parameter to a properly formatted version of the * argument directory string. The proper format is to the platform appropriate separator * character without meaningless leading or trailing separator characters. */// w ww. j a va2 s. co m private void setInitialDefault(String dir) { if (dir == null || dir.length() <= 0) { initialDefault = null; return; } dir = new Path(dir).toOSString(); while (dir.charAt(dir.length() - 1) == File.separatorChar) { dir = dir.substring(0, dir.length() - 1); } initialDefault = dir; }
From source file:com.flexive.core.storage.binary.FxBinaryUtils.java
/** * Get an existing transit file for the given division and handle * * @param divisionId division//from w ww . j a va 2 s . co m * @param handle binary handle * @return the transit file or <code>null</code> if not found */ public static File getTransitFile(int divisionId, final String handle) { File dir = new File( getTransitDirectory() + File.separatorChar + String.valueOf(divisionId) + File.separatorChar); File[] result = dir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.startsWith(handle + "__"); } }); if (result != null && result.length > 0) return result[0]; return null; }
From source file:com.pieframework.runtime.utils.azure.Cspack.java
private String generateRoleDirectories(Component c, File dir, List<File> tmpFiles) { String result = ""; for (String key : c.getChildren().keySet()) { if (c.getChildren().get(key) instanceof Role) { Role role = (Role) c.getChildren().get(key); if (role.getProps().get("type") != null) { if (dir.exists() && dir.isDirectory()) { File roleDir = new File(dir.getPath() + File.separatorChar + role.getId()); roleDir.mkdir();// w ww .j a v a 2 s. c o m tmpFiles.add(roleDir); result += " /role:" + role.getId() + ";" + roleDir.getPath(); if (role.getProps().get("roleEntryPointDLL") != null) { //Stage role binaries stageRoleBinaries(role, roleDir); //Locate the entry dll List<File> flist = ResourceLoader.findExactPath(roleDir, role.getProps().get("roleEntryPointDLL")); if (flist != null && flist.size() > 0) { if (flist.size() == 1) { result += ";" + flist.get(0).getName(); } else { throw new RuntimeException("Found multiple matches for entrypoint dll:" + role.getProps().get("roleEntryPointDLL") + " in " + roleDir.getPath()); } } else { throw new RuntimeException("Found 0 matches for entrypoint dll:" + role.getProps().get("roleEntryPointDLL") + " in " + roleDir.getPath()); } } //Copy startup tasks to the bin directory of the role stageStartupTasks(role, roleDir); } } } } return result; }
From source file:com.sangupta.jerry.util.ZipUtils.java
/** * Extract the given ZIP file into the given destination folder. * //from ww w . j ava2s . c o m * @param zipFile * file to extract * * @param baseFolder * destination folder to extract in */ public static void extractZipToFolder(File zipFile, File baseFolder) { try { byte[] buf = new byte[1024]; ZipInputStream zipinputstream = new ZipInputStream(new FileInputStream(zipFile)); ZipEntry zipentry = zipinputstream.getNextEntry(); while (zipentry != null) { // for each entry to be extracted String entryName = zipentry.getName(); entryName = entryName.replace('/', File.separatorChar); entryName = entryName.replace('\\', File.separatorChar); int numBytes; FileOutputStream fileoutputstream; File newFile = new File(baseFolder, entryName); if (zipentry.isDirectory()) { if (!newFile.mkdirs()) { break; } zipentry = zipinputstream.getNextEntry(); continue; } fileoutputstream = new FileOutputStream(newFile); while ((numBytes = zipinputstream.read(buf, 0, 1024)) > -1) { fileoutputstream.write(buf, 0, numBytes); } fileoutputstream.close(); zipinputstream.closeEntry(); zipentry = zipinputstream.getNextEntry(); } zipinputstream.close(); } catch (Exception e) { e.printStackTrace(); } }