mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-20 16:59:53 +00:00
Add lock id to device, adding download of backups
This commit is contained in:
@@ -92,4 +92,21 @@ public abstract class BackupHandler {
|
||||
return theFilenames;
|
||||
}
|
||||
|
||||
public String downloadBackup(String aFilename) {
|
||||
Path filePath = FileSystems.getDefault().getPath(repositoryPath.getParent().toString(), aFilename);
|
||||
|
||||
String content = null;
|
||||
if (Files.notExists(filePath) || !Files.isReadable(filePath)) {
|
||||
log.warn("Error reading the file: {} - Does not exist or is not readable. continuing...", aFilename);
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
content = new String(Files.readAllBytes(filePath));
|
||||
} catch (IOException e) {
|
||||
log.error("Error reading the file: {} message: {}", aFilename, e.getMessage(), e);
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user