Skip to content

Commit

Permalink
replace existing file if present
Browse files Browse the repository at this point in the history
  • Loading branch information
AlmasB committed Mar 26, 2024
1 parent cc84968 commit d08facc
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.almasb.fxgl.logging.Logger
import java.net.URL
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardCopyOption

/**
* Extracts resources from the deployed jar to the local file system.
Expand All @@ -24,6 +25,7 @@ class ResourceExtractor {

/**
* Extracts the file at jar [url] as a [relativeFilePath].
* Note: the destination file will be overwritten.
*
* @return the url on the local file system of the extracted file
*/
Expand All @@ -45,7 +47,7 @@ class ResourceExtractor {
}

url.openStream().use {
Files.copy(it, file)
Files.copy(it, file, StandardCopyOption.REPLACE_EXISTING)
}

return file.toUri().toURL()
Expand Down

0 comments on commit d08facc

Please sign in to comment.