Java Temp Folder Create GetTempFolder()

Here you can find the source of GetTempFolder()

Description

Get Temp Folder

License

Open Source License

Declaration

public static String GetTempFolder() 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;

public class Main {
    public static String GetTempFolder() {
        //return flybase.Native.tempFolder(); // This is what the readseq library uses.
        String osname = System.getProperty("os.name").toLowerCase();
        File ff = null;//from  w ww.  j a v  a 2 s  .  co m
        if (osname.startsWith("windows") || System.getProperty("file.separator").equals("\\")
                || osname.startsWith("os/2")) {
            ff = new File("\\tmp", "");
            if (ff == null || !ff.exists())
                ff = new File("\\temp", "");
            if (ff == null || !ff.exists())
                ff = new File("c:\\temp", "");
        } else
            ff = new File("/tmp", ""); // assume UNIX
        String fold = null;
        if (ff != null && ff.exists() && ff.isDirectory())
            fold = ff.getPath();
        if (fold == null || fold.length() == 0)
            fold = System.getProperty("user.dir", "") + "/";
        return fold;
    }
}

Related

  1. createTemporaryDirectory(File baseDirectory)
  2. getTempFolder()
  3. getTempFolder()
  4. getTempFolder()
  5. getTempFolder()
  6. getTempFolder(String TEMP_FOLDER_NAME)
  7. getTempFolderPath()