Skip to content

Commit c53d534

Browse files
committed
chore(common-utils): Add convenience code to stash files
This avoids a breaking change by not renaming `DirectoryStash`. Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent abd97bb commit c53d534

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

utils/common/src/main/kotlin/DirectoryStash.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ import kotlin.io.path.moveTo
2929

3030
import org.apache.logging.log4j.kotlin.logger
3131

32+
typealias FileStash = DirectoryStash
33+
3234
/**
3335
* A [Closeable] class which temporarily moves away directories / [files] and moves them back on close. Any conflicting
3436
* directory / file created at the location of an original directory / file is deleted before the original state is
@@ -82,3 +84,8 @@ class DirectoryStash(files: Set<File>) : Closeable {
8284
* A convenience function that stashes directories / files using a [DirectoryStash] instance.
8385
*/
8486
fun stashDirectories(vararg files: File): Closeable = DirectoryStash(setOf(*files))
87+
88+
/**
89+
* A convenience function that stashes directories / files using a [DirectoryStash] instance.
90+
*/
91+
fun stashFiles(vararg files: File): Closeable = FileStash(setOf(*files))

0 commit comments

Comments
 (0)