mirror of
https://github.com/Qortal/qortal.git
synced 2025-04-23 19:37:51 +00:00
Use system temp directory instead of making a "temp" subfolder when zipping files.
This commit is contained in:
parent
fe7c40cb7c
commit
47c70eea9e
@ -136,15 +136,16 @@ public class WebsiteResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure temp folder exists
|
// Ensure temp folder exists
|
||||||
|
java.nio.file.Path tempDir = null;
|
||||||
try {
|
try {
|
||||||
Files.createDirectories(Paths.get("temp"));
|
tempDir = Files.createTempDirectory("qortal-zip");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.error("Unable to create temp directory");
|
LOGGER.error("Unable to create temp directory");
|
||||||
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.REPOSITORY_ISSUE);
|
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.REPOSITORY_ISSUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Firstly zip up the directory
|
// Firstly zip up the directory
|
||||||
String outputFilePath = "temp/zipped.zip";
|
String outputFilePath = tempDir.toString() + File.separator + "zipped.zip";
|
||||||
try {
|
try {
|
||||||
ZipUtils.zip(directoryPath, outputFilePath, "data");
|
ZipUtils.zip(directoryPath, outputFilePath, "data");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user