Example usage for java.io File separator

List of usage examples for java.io File separator

Introduction

In this page you can find the example usage for java.io File separator.

Prototype

String separator

To view the source code for java.io File separator.

Click Source Link

Document

The system-dependent default name-separator character, represented as a string for convenience.

Usage

From source file:Main.java

public static String getCacheFolder(Context context) {
    File cacheFolder = new File(context.getCacheDir().getAbsolutePath() + File.separator + "app_icons");
    if (!cacheFolder.exists()) {
        cacheFolder.mkdir();//from  www.  j a v a 2  s  .  c om
    }
    return cacheFolder.getAbsolutePath();
}

From source file:Main.java

public static String getFileName(String path) {
    Pattern pattern = Pattern.compile("[^\\" + File.separator + "]+.xml");
    Matcher matcher = pattern.matcher(path);
    if (matcher.find())
        return matcher.group().substring(0, matcher.group().length() - 4);
    return "";
}

From source file:Main.java

public static String getCamerPath() {
    return Environment.getExternalStorageDirectory() + File.separator + "FounderNews" + File.separator;
}

From source file:Main.java

public static File getUploadFolder() {
    File file = Environment.getExternalStorageDirectory();
    File path = new File(file, File.separator + "farm" + "");
    if (!path.exists())
        path.mkdir();//  w  w w .j  a v  a 2 s  . c  o  m
    return path;
}

From source file:Main.java

public static boolean haveSuraAyahForQari(String baseDir, int sura, int ayah) {
    String filename = baseDir + File.separator + sura + File.separator + ayah + AUDIO_EXTENSION;
    File f = new File(filename);
    return f.exists();
}

From source file:Main.java

public static File getAudioPath(String fileName, String folderName) {
    File file = new File(Environment.getExternalStorageDirectory() + File.separator + "InstavoiceBlogs"
            + File.separator + "audio" + File.separator + folderName);
    if (!file.exists()) {
        file.mkdirs();//from   ww  w  .ja v a  2 s .  com
    }
    File audioFile = new File(file, "aud_" + fileName);
    return audioFile;
}

From source file:Main.java

public static Boolean mkDirs(String filePath) {
    //int startind=1;
    String dirPath = new File(filePath).getParentFile().getAbsolutePath() + File.separator;

    File dir = new File(dirPath.replace("/", File.separator));
    return dir.exists() || dir.mkdirs();
    //        while(true){
    //             if(startind>=dirPath.length()||startind==-1)
    //                return true;
    //            int slashInd=dirPath.indexOf(File.separator,startind);
    //            if(slashInd==-1)return true;
    //            String subPath=dirPath.substring(0,slashInd);
    //            File f=new File(subPath);
    //            if(!f.exists()&&!f.mkdir()){
    //                return false;
    //            }
    //            startind=subPath.length()+1;
    ///*w w  w  . ja va 2s . c  o  m*/
    //        }

}

From source file:Main.java

public static String makeDir(String dirName) {
    String mRootPath = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + dirName;

    try {//from  w w  w  . ja  v  a  2  s .  c  om
        File fRoot = new File(mRootPath);
        if (fRoot.exists() == false) {
            if (fRoot.mkdirs() == false) {
                throw new Exception("");
            }
        }
    } catch (Exception e) {
        mRootPath = "-1";
    }

    return mRootPath + "/";
}

From source file:Main.java

public static File createPhotoFile(File pictureFileDir, long captureTime) {
    String photoFile = "Picture_" + captureTime + ".jpg";
    String filename = pictureFileDir.getPath() + File.separator + photoFile;
    return new File(filename);
}

From source file:Main.java

public static String getPathForFile(final String filename) {
    return (getPathForSharedStorage() + File.separator + filename);
}