commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gabriele Kahlout (JIRA)" <j...@apache.org>
Subject [jira] Created: (IO-261) getFile with varargs parameter
Date Wed, 09 Feb 2011 16:03:57 GMT
getFile with varargs parameter
------------------------------

                 Key: IO-261
                 URL: https://issues.apache.org/jira/browse/IO-261
             Project: Commons IO
          Issue Type: Improvement
            Reporter: Gabriele Kahlout
            Priority: Minor


Why not have those in FileUtils?    

public static File getFile(final String... dirs) {
        File ret = null;
        for (String dir : dirs) {
            if (ret == null) {
                ret = new File(dir);
            } else {
                ret = new File(ret.getPath(), dir);
            }
        }
        return ret;
    }

    public static File getFile(final File dir, final String... dirs) {
        File ret = dir;
        for (String dir1 : dirs) {
            if (ret == null) {
                ret = new File(dir1);
            } else {
                ret = new File(ret.getPath(), dir1);
            }
        }
        return ret;
    }


-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message