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

Dont log error if BSQ blocks directory does not exist in resources #5909

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import bisq.common.config.Config;
import bisq.common.file.FileUtil;
import bisq.common.file.ResourceNotFoundException;
import bisq.common.proto.persistable.PersistenceProtoResolver;

import protobuf.BaseBlock;
Expand Down Expand Up @@ -104,10 +105,9 @@ public LinkedList<Block> migrateBlocks(List<protobuf.BaseBlock> protobufBlocks)

void copyFromResources(String postFix) {
long ts = System.currentTimeMillis();
String dirName = BsqBlocksStorageService.NAME;
String resourceDir = dirName + postFix;
try {
String dirName = BsqBlocksStorageService.NAME;
String resourceDir = dirName + postFix;

if (storageDir.exists()) {
log.info("No resource directory was copied. {} exists already.", dirName);
return;
Expand All @@ -123,9 +123,13 @@ void copyFromResources(String postFix) {
}
for (String fileName : fileNames) {
File destinationFile = new File(storageDir, fileName);
// File.separator doesn't appear to work on Windows. It has to be "/", not "\".
// See: https://github.com/bisq-network/bisq/pull/5909#pullrequestreview-827992563
FileUtil.resourceToFile(resourceDir + "/" + fileName, destinationFile);
}
log.info("Copying {} resource files took {} ms", fileNames.size(), System.currentTimeMillis() - ts);
} catch (ResourceNotFoundException ignore) {
log.info("Directory {} in resources does not exist.", resourceDir);
} catch (Throwable e) {
e.printStackTrace();
}
Expand Down