List of usage examples for java.io File getAbsolutePath
public String getAbsolutePath()
From source file:Main.java
private static String getRootFolder() { File oRoot = Environment.getExternalStorageDirectory(); return oRoot.getAbsolutePath() + "/" + FOLDER_PERSONAL_TRAINER; }
From source file:Main.java
public static boolean isSubDirectory(File sourceLocation, File targetLocation) { return Pattern.matches(sourceLocation.getAbsolutePath() + ".*", targetLocation.getAbsolutePath()); }
From source file:Main.java
public static String escaped(File path) { return escaped(path.getAbsolutePath()); }
From source file:Main.java
/** * Strips the leading path up to "config". * @param file the file /* w w w.j a v a 2s . c o m*/ * @return the full path after and including the config */ protected static String getRelativeName(final File file) { String absName = file.getAbsolutePath(); int inx = absName.indexOf("config"); if (inx != -1) { return absName.substring(inx, absName.length()); } return null; }
From source file:Main.java
public static boolean updateFile(String path, String filename) { File f = new File(path, filename); Log.e("x", f.getAbsolutePath()); Log.e("x", "" + f.exists()); long fileTime = f.lastModified(); long curTime = System.currentTimeMillis(); long fileAge = curTime - fileTime; Log.d("updateFile", "fileTime: " + fileTime); Log.d("updateFile", "curTime: " + curTime); Log.d("updateFile", "fileage: " + fileAge); // return true if file is older than an hour return fileAge > (1000 * 60 * 60); }
From source file:Main.java
private static boolean deleteFileSafely(File file) { if (file != null) { String tmpPath = file.getAbsolutePath() + System.currentTimeMillis(); File tmp = new File(tmpPath); boolean result = file.renameTo(tmp); return result && tmp.delete(); }/*from ww w .j a v a 2 s.c o m*/ return false; }
From source file:Main.java
public static void scanFile(Context context, File file) { MediaScannerConnection.scanFile(context, new String[] { file.getAbsolutePath() }, new String[] { "image/jpeg" }, null); }
From source file:Main.java
public static boolean writeTextContentToFile(String content, File dstFile) { return writeTextContentToFile(content, dstFile.getAbsolutePath()); }
From source file:Main.java
public static void changeFilePermission(File file) { try {/*w ww. ja v a 2 s. c o m*/ String command = "chmod 666 " + file.getAbsolutePath(); Runtime.getRuntime().exec(command); } catch (IOException e) { e.printStackTrace(); } }
From source file:Main.java
public static List<String> abreArquivo(File arquivo) { return abreArquivo(arquivo.getAbsolutePath()); }