Get the file points to an external notifications directory.
@param context the context.
@return the {@link java.io.File}.
777609
@TargetApi(Build.VERSION_CODES.FROYO)
    public static File getExternalFilesDirForNotifications(Context context) {
        return context.getExternalFilesDir(Environment.DIRECTORY_NOTIFICATIONS);
    }
1331414
@Override
    public void setContext(Context context) {
        super.setContext(context);

        fsInfo = FSInfo.instance(context);

        symbolFileEnabled = !options.isSet("ignore.symbol.file");

        String sf = options.get("sortFiles");
        if (sf != null) {
            sortFiles = (sf.equals("reverse") ? SortFiles.REVERSE : SortFiles.FORWARD);
        }
    }
1126533
public String toFile() throws Exception {
        File file = File.createTempFile("GuiceDependencies_", ".dot");
        toFile(file);
        return file.getCanonicalPath();
    }
1148040
@DefinedBy(Api.COMPILER)
    public JavaFileObject getSource() {
        if (source == null)
            return null;
        else
            return source.getFile();
    }
708407
@SuppressWarnings("WeakerAccess")
    @NonNull
    public static Uri getUriForFile(@NonNull Context context, @NonNull Directory directory, @NonNull String relativePath) {
        final Uri.Builder builder = new Uri.Builder()
                .scheme(ContentResolver.SCHEME_CONTENT)
                .authority(getAuthority(context))
                .appendPath(directory.name().toLowerCase());
        for (String segment : relativePath.split(Pattern.quote(File.separator))) {
            if (segment.length() > 0) {
                builder.appendPath(segment);
            }
        }
        return builder.build();
    }
1311776
@TargetApi(Build.VERSION_CODES.FROYO)
    public static File getExternalFilesDirForMusic(Context context) {
        return context.getExternalFilesDir(Environment.DIRECTORY_MUSIC);
    }
685486
public static File getInternalDir(Context context, String path, boolean createIfNecessary) {
		File filesDir = context.getFilesDir();
		File internalDir = new File(filesDir, path);
		if (!internalDir.exists() && createIfNecessary) {
			boolean succeed = internalDir.mkdirs();
			if (!succeed) {
				ApptentiveLog.w(UTIL, "Unable to create internal directory: %s", internalDir);
			}
		}
		return internalDir;
	}
76359
@TargetApi(Build.VERSION_CODES.FROYO)
    public static File getExternalFilesDirForPodCasts(Context context) {
        return context.getExternalFilesDir(Environment.DIRECTORY_PODCASTS);
    }
237219
@TargetApi(Build.VERSION_CODES.FROYO)
    public static File getExternalFilesDirForDcim(Context context) {
        return context.getExternalFilesDir(Environment.DIRECTORY_DCIM);
    }
698474
public static File getStorage(final Context ctx) {
        //Map<String, File> allStorageLocations = getAllStorageLocations();
        //if (allStorageLocations.isEmpty()){
        //use the current app's storage
        //  return Environment.getDataDirectory();
        //}

        StorageInfo ptr = null;
        List<StorageInfo> storageList = getStorageList();
        for (int i = 0; i < storageList.size(); i++) {
            StorageInfo storageInfo = storageList.get(i);
            if (!storageInfo.readonly && isWritable(new File(storageInfo.path))) {
                if (ptr != null) {
                    //compare free space
                    if (ptr.freeSpace < storageInfo.freeSpace) {
                        ptr = storageInfo;
                    }
                } else {
                    ptr = storageInfo;
                }
            }
        }
        if (ptr != null) {
            return new File(ptr.path);
        }
        //http://stackoverflow.com/questions/21230629/getfilesdir-vs-environment-getdatadirectory
        return new File(ctx.getDatabasePath("temp.sqlite").getAbsolutePath().replace("temp.sqlite", ""));
    }
972178
public static Uri getUriForInternalMedia(Context context, File file) {
        String authority = context.getPackageName() + ".fileprovider";
        return FileProvider.getUriForFile(context, authority, file);
    }
1049865
public static Observable<String> getPathFromUriForFileDocument(final Context context,
      final Uri contentUri) {
    return Observable.fromCallable(new Func0<String>() {
      @Override
      public String call() {
        String pathFound = null;
        Cursor cursor = context.getContentResolver().query(contentUri, null, null, null, null);
        if (cursor != null) {
          if (cursor.moveToFirst()) {
            pathFound =
                cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DATA));
          }
          cursor.close();
          logDebug("Path found:" + pathFound);
        }
        return pathFound;
      }
    });
  }
1295145
@Override
    public String getContextPath() {
        if (SecurityUtil.isPackageProtectionEnabled()) {
            return (String) doPrivileged("getContextPath", null);
        } else {
            return context.getContextPath();
        }
    }
587923
public static File generateExternalImageCacheFile(Context context, String ext) {
        String fileName = "img_" + System.currentTimeMillis();
        return generateExternalImageCacheFile(context, fileName, ext);
    }
1096334
@javax.annotation.Nonnull
  public File getResourceDir() {
    @javax.annotation.Nonnull final File etc = new File(fileName.getParentFile(), "etc");
    etc.mkdirs();
    return etc;
  }
83902
private void collectFilesAndStore(final Context context, final Path dir, final int level) throws FrameworkException {

		if (level == 1) {
			logger.info("Path {}", dir);
		}

		try (final DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {

			for (final Path p : stream) {

				if (Files.isDirectory(p)) {

					collectFilesAndStore(context, p, level+1);

				} else {

					context.update(storeLogEntry(p));

					// update object count and commit
					context.commit(true);
				}

				Files.delete(p);

			}

		} catch (IOException ioex) {
			logger.warn("", ioex);
		}
	}
453909
@Nullable
  private File getCachedFile(String url) throws FileNotFoundException {
    File jsonFile = new File(appContext.getCacheDir(), filenameForUrl(url, FileExtension.JSON, false));
    if (jsonFile.exists()) {
      return jsonFile;
    }
    File zipFile = new File(appContext.getCacheDir(), filenameForUrl(url, FileExtension.ZIP, false));
    if (zipFile.exists()) {
      return zipFile;
    }
    return null;
  }