List of usage examples for java.io File separator
String separator
To view the source code for java.io File separator.
Click Source Link
From source file:Main.java
/** * Copy database files to the given folder. Useful for debugging. * * @param folder the directory to copy files into *//*from w w w . j a v a 2 s .c om*/ public static void copyDatabases(Context context, String folder) { File folderFile = new File(folder); if (!folderFile.exists()) { folderFile.mkdir(); } for (String db : context.databaseList()) { File dbFile = context.getDatabasePath(db); try { copyFile(dbFile, new File(folderFile.getAbsolutePath() + File.separator + db)); } catch (Exception e) { Log.e("ERROR", "ERROR COPYING DB " + db, e); } } }
From source file:Main.java
public static String getNamespaceFolder(String rootFolder, String namespace) { return rootFolder + File.separator + namespace; }
From source file:ch.oakmountain.tpa.web.TpaPersistorUtils.java
public static void copyFromResourceToDir(String fileName, String outputDir) throws IOException { String content = IOUtils.toString(TpaWebPersistor.class.getResourceAsStream(File.separator + fileName)); FileUtils.writeStringToFile(new File(outputDir + File.separator + fileName), content); }
From source file:Main.java
public static String getStaleFormsFolder(String appName) { String path = getAppFolder(appName) + File.separator + STALE_FORMS_FOLDER_NAME; return path; }
From source file:Main.java
public static boolean isLanguageOK(String x) { boolean rc = false; if (x.contentEquals("none")) return (true); File f = new File( "languagetool" + File.separator + "rules" + File.separator + x.substring(0, x.indexOf("_"))); if (f.isDirectory()) rc = true;/*from w ww . ja v a2 s .c o m*/ return (rc); }
From source file:com.thoughtworks.go.util.FilenameUtil.java
public static boolean isNormalizedDirectoryPathInsideNormalizedParentDirectory(String parent, String subdirectory) {//from w w w .j av a 2 s .c o m final String normalizedParentPath = FilenameUtils.normalize(parent + File.separator); final String normalizedSubDirPath = FilenameUtils.normalize(subdirectory + File.separator); return StringUtils.isNotBlank(normalizedParentPath) && StringUtils.isNotBlank(normalizedSubDirPath) && normalizedSubDirPath.startsWith(normalizedParentPath); }
From source file:mesclasses.util.FileSaveUtil.java
public static File archive() throws IOException { FileConfigurationManager conf = FileConfigurationManager.getInstance(); File archiveFile = new File( new StringBuilder(conf.getArchivesDir()).append(File.separator).append("mesclasses_archive_") .append(LocalDate.now().format(Constants.DATE_FORMATTER)).append(".zip").toString()); if (archiveFile.exists()) { archiveFile.delete();//from www .j a va 2 s. c om } ZipUtil.pack(new File(conf.getSaveDir()), archiveFile); LOG.info("Archive cre : " + archiveFile.getPath()); return archiveFile; }
From source file:Main.java
public static String getStaleFrameworkFolder(String appName) { String path = getAppFolder(appName) + File.separator + STALE_FRAMEWORK_FOLDER_NAME; return path;// w w w .j av a2 s . co m }
From source file:Main.java
public static File asConfigFile(String appName, String relativePath) { return new File(getConfigFolder(appName) + File.separator + relativePath); }
From source file:Main.java
public static File getOutputMediaFile(int type, String folderName) { File mediaStorageDir = new File( Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), folderName); if (!mediaStorageDir.exists()) { if (!mediaStorageDir.mkdirs()) { Log.d(folderName, "failed to create directory"); return null; }/*from w w w .j a v a 2 s. c o m*/ } String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); File mediaFile; if (type == MEDIA_TYPE_IMAGE) { mediaFile = new File(mediaStorageDir.getPath() + File.separator + "IMG_" + timeStamp + ".jpg"); } else if (type == MEDIA_TYPE_VIDEO) { mediaFile = new File(mediaStorageDir.getPath() + File.separator + "VID_" + timeStamp + ".mp4"); } else if (type == MEDIA_TYPE_AUDIO) { mediaFile = new File(mediaStorageDir.getPath() + File.separator + "AUD_" + timeStamp + ".3gp"); } else { return null; } return mediaFile; }