Skip to content
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

tempdir: Delete temporary directories recursively #2227

Merged
merged 2 commits into from
Jun 1, 2021

Conversation

sschuberth
Copy link
Member

While delete() works on directories, they must be empty for delete() to
succeed. However, temporary directories should be deleted recursively,
including any contained files and / or subdirectories.

@sschuberth
Copy link
Member Author

@sksamuel can this still make it into the 4.5.0 release?

@sksamuel
Copy link
Member

sksamuel commented Apr 26, 2021 via email

@sksamuel
Copy link
Member

Can we get a test

Previously, the logic to use javaClass.name as the default prefix could
have been bypassed by setting the prefix to null. Avoid that by making
javaClass.name the fallback if the prefix is null. This is a fixup for
5e78d68.

Also align the temp{dir,file} functions to both use the new API functions
kotlin.io.path.createTemp{Directory,File}, and avoid a duplicate
toFile() conversion.
While delete() works on directories, they must be empty for delete() to
succeed. However, temporary directories should be deleted recursively,
including any contained files and / or subdirectories.
@sschuberth
Copy link
Member Author

Can we get a test

Sorry, I didn't have time until now, but I've adapted the existing test now accordingly. and also added another improvement commit.

@sschuberth sschuberth requested a review from sksamuel May 29, 2021 08:42
@sschuberth
Copy link
Member Author

@sksamuel I don't think the test failure on Ubuntu is related to my changes...

@sksamuel
Copy link
Member

sksamuel commented Jun 1, 2021

Yeah it's not, lgtm.

@sksamuel sksamuel merged commit 212184c into master Jun 1, 2021
@sksamuel sksamuel deleted the tempdir-delete-recursively branch June 1, 2021 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants