tds/src/main/java/thredds/server/reify/LoadCommon.java
static File
    findSystemTempDir(String[] candidates)
    {
        for(String candidate : candidates) {
            File f = new File(candidate);
            if(f.exists() && f.canRead() && f.canWrite())
                return f;
            if(f.mkdirs()) // Try to create the path
                return f;
        }
        // As a last resort use the java temp file mechanism
        try {
            File tempfile = File.createTempFile("tmp", "tmp");
            File tempdir = tempfile.getParentFile();
            if(!tempdir.canWrite() || !tempdir.canRead())
                return null;
            return tempdir;
        } catch (IOException e) {
            return null;
        }
    }
static File
    findSystemTempDir(String[] candidates)
    {
        for(String candidate : candidates) {
            File f = new File(candidate);
            if(f.exists() && f.canRead() && f.canWrite())
                return f;
            if(f.mkdirs()) // Try to create the path
                return f;
        }
        // As a last resort use the java temp file mechanism
        try {
            File tempfile = File.createTempFile("tmp", "tmp");
            File tempdir = tempfile.getParentFile();
            if(!tempdir.canWrite() || !tempdir.canRead())
                return null;
            return tempdir;
        } catch (IOException e) {
            return null;
        }
    }
static File findSystemTempDir ( String [ ] candidates ) { for ( String candidate : candidates ) { File f = new File ( candidate ) ; if ( f . exists ( ) && f . canRead ( ) && f . canWrite ( ) ) return f ; if ( f . mkdirs ( ) ) // Try to create the path return f ; } // As a last resort use the java temp file mechanism try { File tempfile = File . createTempFile ( "tmp" , "tmp" ) ; File tempdir = tempfile . getParentFile ( ) ; if ( ! tempdir . canWrite ( ) || ! tempdir . canRead ( ) ) return null ; return tempdir ; } catch ( IOException e ) { return null ; } }
Static Methods
Static Methods