commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "BELUGA BEHR (JIRA)" <j...@apache.org>
Subject [jira] [Created] (IO-413) deleteQuietly(File) should try to closeOnDelete too
Date Sat, 30 Nov 2013 05:50:35 GMT
BELUGA BEHR created IO-413:
------------------------------

             Summary: deleteQuietly(File) should try to closeOnDelete too
                 Key: IO-413
                 URL: https://issues.apache.org/jira/browse/IO-413
             Project: Commons IO
          Issue Type: Improvement
          Components: Utilities
            Reporter: BELUGA BEHR
            Priority: Minor


Something like...

{code}
    public static boolean deleteQuietly(final File file, final boolean deleteOnExit) {
        boolean fileDelete = false;
        if (file == null) {
            return false;
        }
        try {
            if (file.isDirectory()) {
                cleanDirectory(file);
            }
        } catch (final Exception ignored) {
        }

        try {
            fileDelete = file.delete();
        } catch (final Exception ignored) {
            return false;
        }

       if (deleteOnExit && !fileDeleted)
       {
           file.deleteOnExit();
       }
    }
{code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message