-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow deletion of empty folders #1630
Allow deletion of empty folders #1630
Conversation
(even though we normally don't allow operations on folders since they are not represented). This helps with NIO-using code that must also work with filesystems that *do* represent folders.
The holdup on this PR is blocking gatk#2441. Would it be possible to please have someone look at it? @garrettjonesgoogle maybe? |
} | ||
} | ||
|
||
@Test(expected = CloudStoragePseudoDirectoryException.class) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
* @param directory the directory to delete | ||
* @throws IOException | ||
*/ | ||
static private void deleteRecursive(Path directory) throws IOException { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
assertThat(Files.exists(fs.getPath("playwrights/French/Corneille"))).isFalse(); | ||
assertThat(Files.exists(fs.getPath("Racine"))).isTrue(); | ||
Files.deleteIfExists(fs.getPath("Racine")); | ||
} |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
* @param directory the directory to delete | ||
* @throws IOException | ||
*/ | ||
static private void deleteRecursive(Path directory) throws IOException { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
// We can't check Files.exists on a folder (since GCS fakes folders), | ||
Path dir = fs.getPath("dir/"); | ||
Files.deleteIfExists(dir); | ||
} |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
assertThat(Files.exists(fs.getPath("dir/dir3/cloud"))).isFalse(); | ||
assertThat(Files.exists(fs.getPath("atroot"))).isTrue(); | ||
} | ||
} |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Thank you very much for taking a look! I'm pushing a new version that should address everything. |
Changes Unknown when pulling 05b8bee on jean-philippe-martin:jp_delete_empty_folder into ** on GoogleCloudPlatform:master**. |
Thank you! |
Changes Unknown when pulling 6900323 on jean-philippe-martin:jp_delete_empty_folder into ** on GoogleCloudPlatform:master**. |
(even though we normally don't allow operations on folders
since they are not represented). This helps with NIO-using code
that must also work with filesystems that do represent folders.
Also add a test for
Files.WalkFileTree
.This should help with issue #1519