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:com.photon.phresco.framework.actions.FrameworkBaseAction.java
protected List<String> getProjectModules(String projectCode) { try {//from www . ja va 2s .co m StringBuilder builder = getProjectHome(projectCode); builder.append(File.separatorChar); builder.append(POM_XML); File pomPath = new File(builder.toString()); PomProcessor processor = new PomProcessor(pomPath); Modules pomModule = processor.getPomModule(); if (pomModule != null) { return pomModule.getModule(); } } catch (JAXBException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (PhrescoPomException e) { e.printStackTrace(); } return null; }
From source file:eu.openanalytics.rpooli.RPooliContext.java
@Override protected PathEntry searchLib(final List<PathEntry> files, final String libId) { final Pattern pattern = compile(".*" + quote(File.separatorChar + libId) + "([-_]{1}.*)?\\.jar$"); for (final PathEntry entry : files) { if (pattern.matcher(entry.getPath()).matches()) { return entry; }/*w w w . ja v a2 s .c om*/ } return null; }
From source file:com.qualogy.qafe.bind.core.application.ApplicationStack.java
@Deprecated public void loadSystemMenu(URI filePath) { if (globalConfiguration != null && filePath != null) { String fileName = globalConfiguration.get(QAFEKeywords.SYSTEM_APP); // For the system file menu we need to look it up at another location ApplicationMapping appMapping = null; if (fileName.indexOf(QAFEKeywords.SYSTEM_APP_DEFAULT_FILENAME) >= 0) { InputStream in = getClass().getResourceAsStream("/" + QAFEKeywords.SYSTEM_APP_DEFAULT_FILENAME); if (in != null) { appMapping = (ApplicationMapping) new Reader(ApplicationMapping.class).read(in); }//from w w w . j a v a 2 s. c om } else { File file = new File(filePath); String location = file.getAbsolutePath().substring(0, file.getAbsolutePath().lastIndexOf(File.separatorChar)) + File.separatorChar + fileName; appMapping = ((ApplicationMapping) new Reader(ApplicationMapping.class).read(location)); } if (appMapping != null) { ApplicationContext applicationContext = new ApplicationContext(); applicationContext.setApplicationMapping(appMapping); File file = new File(filePath); File origLocation = new File(file.getAbsolutePath().substring(0, file.getAbsolutePath().lastIndexOf(File.separatorChar))); applicationContext.setOriginAppConfigFileLocation(origLocation.toURI()); applicationContext.setId(new ApplicationIdentifier(QAFEKeywords.SYSTEM_APP)); globalConfiguration.setSystemApplication(applicationContext); } } }
From source file:mondrian.test.DiffRepository.java
private static File findFile(Class clazz, List<String> javaPrefixes, List<String> resourcePrefixes, String suffix) {//from www.j a v a 2s .c om // The reference file for class "com.foo.Bar" is "com/foo/Bar.ref.xml" String rest = clazz.getName().replace('.', File.separatorChar) + suffix; File fileBase = getFileBase(clazz, javaPrefixes, resourcePrefixes); return new File(fileBase, rest); }
From source file:org.red5.server.Bootstrap.java
/** * Gets the Red5 root//from ww w . j a v a 2s .c o m * * @return * @throws IOException */ private static String getRed5Root() throws IOException { // look for red5 root first as a system property String root = System.getProperty("red5.root"); // if root is null check environmental if (root == null) { //check for env variable root = System.getenv("RED5_HOME"); } // if root is null find out current directory and use it as root if (root == null || ".".equals(root)) { root = System.getProperty("user.dir"); //System.out.printf("Current directory: %s\n", root); } //if were on a windows based os flip the slashes if (File.separatorChar != '/') { root = root.replaceAll("\\\\", "/"); } //drop last slash if exists if (root.charAt(root.length() - 1) == '/') { root = root.substring(0, root.length() - 1); } //set/reset property System.setProperty("red5.root", root); System.out.printf("Red5 root: %s\n", root); return root; }
From source file:com.eviware.soapui.impl.wsdl.support.wss.crypto.KeyMaterialWssCrypto.java
public String getLabel() { String source = getSource();//from w ww .ja va 2 s.com int ix = source.lastIndexOf(File.separatorChar); if (ix == -1) ix = source.lastIndexOf('/'); if (ix != -1) source = source.substring(ix + 1); return source; }
From source file:net.sourceforge.mavenhippo.SourceCodeBeanFinder.java
private String normalizePath(String path) { String result;//from w w w. j ava2 s . c o m if (path.startsWith("/")) { result = path; } else { result = "/" + path; } return result.replace('/', File.separatorChar); }
From source file:eionet.gdem.utils.Utils.java
/** * Stores a String in a text file.// w w w .j ava 2 s . c o m * * @param fileName - file name to save to. Can be null. * @param str - text to be stored * @param extension - file extension * @throws IOException If an error occurs. */ public static String saveStrToFile(String fileName, String str, String extension) throws IOException { if (fileName == null) { fileName = Properties.tmpFolder + File.separatorChar + "gdem_" + System.currentTimeMillis() + "." + extension; } else { if (extension != null) { fileName = fileName + "." + extension; } } FileUtils.writeStringToFile(new File(fileName), str, "UTF-8"); return fileName; }
From source file:com.lwr.software.reporter.utils.Q2RContextListener.java
@Override public void contextInitialized(ServletContextEvent contextEvent) { logger.info("Creating directories if already created"); logger.info("Creating config directory tree " + DashboardConstants.CONFIG_PATH); File dir = new File(DashboardConstants.CONFIG_PATH); if (dir.exists()) { logger.info("Config directory tree already exists"); } else {//from w w w . ja va2 s . co m boolean dirCreated = dir.mkdirs(); if (dirCreated) { logger.info("Config directory tree created successfully"); } else { logger.error("Config directory tree creation failed, please check for file permission on " + DashboardConstants.CONFIG_PATH); } } logger.info("Creating public report directory tree " + DashboardConstants.PUBLIC_REPORT_DIR); dir = new File(DashboardConstants.PUBLIC_REPORT_DIR); if (dir.exists()) { logger.info("Public report directory tree already exists"); } else { boolean dirCreated = dir.mkdirs(); if (dirCreated) { logger.info("Public report directory tree created successfully"); } else { logger.error("Public report directory tree creation failed, please check for file permission on " + DashboardConstants.PUBLIC_REPORT_DIR); } } logger.info("Creating private report directory tree " + DashboardConstants.PRIVATE_REPORT_DIR); dir = new File(DashboardConstants.PRIVATE_REPORT_DIR); if (dir.exists()) { logger.info("Private report directory tree already exists"); } else { boolean dirCreated = dir.mkdirs(); if (dirCreated) { logger.info("Private report directory tree created successfully"); } else { logger.error("Private report directory tree creation failed, please check for file permission on " + DashboardConstants.PRIVATE_REPORT_DIR); } } logger.info("Creating private report directory tree " + DashboardConstants.APPLN_TEMP_DIR); dir = new File(DashboardConstants.APPLN_TEMP_DIR); if (dir.exists()) { logger.info("Private report directory tree already exists"); } else { boolean dirCreated = dir.mkdirs(); if (dirCreated) { logger.info("Private report directory tree created successfully"); } else { logger.error("Private report directory tree creation failed, please check for file permission on " + DashboardConstants.APPLN_TEMP_DIR); } } File logoFile = new File(DashboardConstants.APPLN_LOGO_FILE); if (logoFile.exists()) { String appLogo = contextEvent.getServletContext().getRealPath("/") + File.separatorChar + "images" + File.separatorChar + "q2r.png"; File appLogoFile = new File(appLogo); logger.info("Coping of custom logo file " + logoFile.getAbsolutePath() + " to folder " + appLogoFile.getAbsolutePath()); try { Files.copy(logoFile, appLogoFile); logger.info("Coping of custom logo file " + logoFile.getAbsolutePath() + " to folder " + appLogoFile.getAbsolutePath() + " -- Copied"); } catch (IOException e) { logger.error("Coping of custom logo file " + logoFile.getAbsolutePath() + " to folder " + appLogoFile.getAbsolutePath() + " -- Failed", e); } } Q2RProperties.getInstance(); logger.info("Loading build time from manifest file"); try { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("/META-INF/MANIFEST.MF"); Manifest manifest = new Manifest(inputStream); String buildTime = manifest.getMainAttributes().getValue("Build-Time"); logger.info("Build time is " + buildTime); if (buildTime != null) Q2RProperties.getInstance().put("buildTime", buildTime); } catch (IOException e) { logger.error("Error loading manifest file", e); } }
From source file:org.messic.server.api.APIAlbum.java
@Transactional public void getAlbumZip(User user, Long albumSid, OutputStream os) throws IOException { MDOAlbum album = this.daoAlbum.getAlbum(albumSid, user.getLogin()); if (album != null) { String basePath = album.calculateAbsolutePath(daoSettings.getSettings()); Util.zipFolder(basePath + File.separatorChar, os); } else {/*w ww . ja va 2 s . c o m*/ throw new IOException("Album not found!"); } }