@Override public String[] fileList() { return mBase.fileList(); }
@Test public void fileList() throws Exception { assertThat(context.fileList()).isEqualTo(context.getFilesDir().list()); }
@Override public String[] fileList() { return mBase.fileList(); }
private boolean hasCrashReport() { return Arrays.asList(appCtx.fileList()).contains(CRASHREPORT); }
public static List<File> getAllIcons(Context context) { List<File> files = new ArrayList<>(); for (String fn: context.fileList()) { if (fn.endsWith(".png")) { Log.d("SpecialIconStore", " I see file " + fn); files.add(new File(context.getFilesDir(), fn)); } } return files; }
public List<String> listBackups() { List<String> list = new ArrayList<>(); Pattern bakpat = Pattern.compile("^" + Pattern.quote(BK_PRE) + "(.+)"); for (String file: mContext.fileList()) { Matcher m = bakpat.matcher(file); if (m.matches()) { list.add(m.group(1)); } } Collections.sort(list); Collections.reverse(list); return list; }
/** * Delete the wishlist * * @param mCtx A context to open the file wish */ public static void ResetCards(Context mCtx) { String[] files = mCtx.fileList(); for (String fileName : files) { if (fileName.equals(WISHLIST_NAME)) { mCtx.deleteFile(fileName); } } }
/** Deletes all secrets from the phone. * @param context the current context * @return always true */ public static boolean deleteSecrets(Context context) { Log.d(LOG_TAG, "FileUtils.deleteSecrets"); synchronized (lock) { String filenames[] = context.fileList(); for (String filename : filenames) { context.deleteFile(filename); } } return true; }
String[] filenames = context.fileList();
/** * Get all existing restore points, including the restore file on the SD card * if it exists. * * @param context Activity context in which the save is called. * @return A list of all possible restore points. */ public static List<String> getRestorePoints(Context context) { String[] filenames = context.fileList(); ArrayList<String> list = new ArrayList<String>(filenames.length + 2); if (restoreFileExist()) list.add(SECRETS_FILE_NAME_SDCARD); // To ease restoring from Google Drive, look for a secrets file in the // downloads folder and add that option. File downloads = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_DOWNLOADS); File rpDownload = new File(downloads, SECRETS_FILE_NAME); if (rpDownload.exists()) list.add(rpDownload.getAbsolutePath()); for (String filename : filenames) { if (filename.startsWith(RP_PREFIX)) list.add(filename); } return list; }
@Override public Set<String> enumerate() { return Stream.of(context.fileList()) .filter(name -> name.endsWith(".conf")) .map(name -> name.substring(0, name.length() - ".conf".length())) .collect(Collectors.toUnmodifiableSet()); }
Log.d(LOG_TAG, "FileUtils.cleanupDataFiles"); synchronized (lock) { String[] filenames = context.fileList(); int oldCount = filenames.length; boolean secretsFileExists = context.getFileStreamPath(SECRETS_FILE_NAME)