List of usage examples for java.io File mkdirs
public boolean mkdirs()
From source file:Main.java
public static File getFilesDirectory(String name) { File file = new File(Environment.getExternalStorageDirectory(), name); if (!file.exists()) { file.mkdirs(); }//from ww w . j a v a2 s . c om return file; }
From source file:Main.java
public static File getOutputMediaFile(Context mContext) { File mediaStorageDir = mContext.getExternalFilesDir(cacheCampareImage); if (!mediaStorageDir.exists()) { if (!mediaStorageDir.mkdirs()) { return null; }/*from ww w . ja va2s . com*/ } String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); File mediaFile; mediaFile = new File(mediaStorageDir.getPath() + File.separator + "IMG_" + timeStamp + ".jpg"); return mediaFile; }
From source file:com.intuit.tank.dao.util.ProjectDaoUtil.java
/** * @param jobId//from www . ja v a2 s . c om * @return */ private static File createScriptFile(String jobId) { String parent = new TankConfig().getTmpDir(); File parentDir = new File(parent); if (!parentDir.exists()) { parentDir.mkdirs(); } File f = new File(parentDir, jobId); return f; }
From source file:Main.java
/** * Helper method to retrieve the application internal storage cache * directory and make sure it exists./* w w w. j a v a 2 s . c o m*/ */ @CheckForNull static File getInternalAppCacheDir(@Nonnull Context context) { File intCacheDir = context.getCacheDir(); if (intCacheDir != null && !intCacheDir.exists()) { if (!intCacheDir.mkdirs() || !intCacheDir.canWrite()) { intCacheDir = null; } } return intCacheDir; }
From source file:Main.java
/** * Retrieves FreeFlight media directory. * May return null.//from w w w . java 2 s .c om * @param context * @return Media directory to store the media files or null if sd card is not mounted. */ public static File getMediaFolder(Context context) { File dcimFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM); if (dcimFolder == null) { Log.w(TAG, "Looks like sd card is not available."); return null; } File mediaFolder = new File(dcimFolder, MEDIA_PUBLIC_FOLDER_NAME); if (!mediaFolder.exists()) { mediaFolder.mkdirs(); Log.d(TAG, "Root media folder created " + mediaFolder); } return mediaFolder; }
From source file:Main.java
public static File getDataDir(Context context) { File file = new File(Environment.getExternalStorageDirectory(), context.getPackageName() + "/data"); if (!file.exists()) { file.mkdirs(); }// w ww . j a v a 2s . c o m return file; }
From source file:Main.java
public static File getPiiicFile(Context paramContext, String paramString) { File localFile = new File(Environment.getExternalStorageDirectory(), "Piiic"); if ((!localFile.exists()) || (localFile.isFile())) localFile.mkdirs(); return new File(localFile, paramString); }
From source file:Main.java
private static File getBackupFile() { File file = new File(Environment.getExternalStorageDirectory() + BACKUP_DIRECTORY_PATH); if (!file.exists() && !file.mkdirs()) { return null; }/*w w w.j a v a 2s.c om*/ file = new File(Environment.getExternalStorageDirectory() + BACKUP_DIRECTORY_PATH, BACKUP_FILE); return file; }
From source file:com.codename1.tools.javadoc.sourceembed.javadocsourceembed.Main.java
public static void directoryWalker(File f, File destDir) throws Exception { File[] files = f.listFiles((path) -> path.isDirectory() || path.getName().endsWith(".java")); for (File ff : files) { if (ff.isDirectory()) { File destDirT = new File(destDir, ff.getName()); destDirT.mkdirs(); directoryWalker(ff, destDirT); } else {// w ww . java2 s . c o m processFile(ff, new File(destDir, ff.getName())); } } }
From source file:com.thoughtworks.go.util.TempFiles.java
private static File tempFolder() { File cruiseTmpDir = new File(System.getProperty("java.io.tmpdir"), "cruise"); cruiseTmpDir.mkdirs(); return cruiseTmpDir; }