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
public static String getSimpleName(String fileName) { String str = fileName;/*from w w w .j av a2 s. c o m*/ if (str == null) { return null; } if (str.lastIndexOf(File.separator) >= 0) { str = str.substring(str.lastIndexOf(File.separator) + 1); } if (str.indexOf(".") >= 0) { str = str.substring(0, str.lastIndexOf(".")); } return str; }
From source file:Main.java
public static File getHomeFileLoc() { File sdcard = Environment.getExternalStorageDirectory(); File sdpath = new File(sdcard.getAbsolutePath() + File.separator + "KnouNotice"); if (!sdpath.exists()) { boolean flag = sdpath.mkdirs(); }/* w w w. j a va2 s . c o m*/ return sdpath; }
From source file:Main.java
public static boolean isFileExist(String fileName, String path) { File file = new File(SDCardRoot + path + File.separator + fileName); return file.exists(); }
From source file:Main.java
public static String getSaveDirPath() { return Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + FILE_SAVE; }
From source file:Main.java
public static void deleteFile(String fileName) { File file = new File( Environment.getExternalStorageDirectory().getPath() + "/kidsedu/temp" + File.separator + fileName); if (file.exists()) { file.delete();//ww w . jav a 2s . c o m } }
From source file:Main.java
public static File getDiskCacheDir(Context context, String file_name) { final String cachePath = context.getCacheDir().getPath(); return new File(cachePath + File.separator + file_name); }
From source file:Main.java
public static String getAbsoluteClassPath(Class<?> clazz) { String classPath = clazz.getClassLoader().getResource("/").getPath(); // For Windows if ("\\".equals(File.separator)) { classPath = classPath.substring(1).replace("/", "\\"); }//from w w w .ja v a 2 s . co m // For Linux if ("/".equals(File.separator)) { classPath = classPath.replace("\\", "/"); } return classPath; }
From source file:Main.java
public static File getSDCardSoPath() { String fileStr = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator; File f = new File(fileStr); if (!f.exists()) { f.mkdirs();//from w w w .j a va 2 s .c om } return f; }
From source file:Main.java
public static File getFontDir(Context context) { File dir = null;// w w w .j a va 2 s.c o m dir = new File(context.getCacheDir() + File.separator + "wanjia" + File.separator + "font"); File nomediaFile = new File(dir.getAbsolutePath() + File.separator + ".nomedia"); if (!dir.exists()) { dir.mkdirs(); } if (!nomediaFile.exists()) { try { nomediaFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } return dir; }
From source file:Main.java
public static File getMateralDir(Context context) { File dir = null;/*from w w w . j a v a2 s .c om*/ dir = new File(context.getCacheDir() + File.separator + "wanjia" + File.separator + "material"); File nomediaFile = new File(dir.getAbsolutePath() + File.separator + ".nomedia"); if (!dir.exists()) { dir.mkdirs(); } if (!nomediaFile.exists()) { try { nomediaFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } return dir; }