diff --git a/app/src/main/java/lightcontainer/App.java b/app/src/main/java/lightcontainer/App.java index 88d4ae3..c951d96 100644 --- a/app/src/main/java/lightcontainer/App.java +++ b/app/src/main/java/lightcontainer/App.java @@ -37,7 +37,7 @@ public class App { protocolRep.addReader(new SignupRule(protocolRep)); protocolRep.addReader(new SignoutRule()); protocolRep.addReader(new FilelistRule(protocolRep)); - protocolRep.addReader(new SavefileRule(protocolRep)); + protocolRep.addReader(new SavefileRule(protocolRep, repositoryStorage.getStoragePath())); protocolRep.addReader(new SendOkRule(protocolRep)); protocolRep.addWriter(new SignOkRule()); diff --git a/app/src/main/java/lightcontainer/protocol/rules/reader/SavefileRule.java b/app/src/main/java/lightcontainer/protocol/rules/reader/SavefileRule.java index 5f1bfa8..90d95c9 100644 --- a/app/src/main/java/lightcontainer/protocol/rules/reader/SavefileRule.java +++ b/app/src/main/java/lightcontainer/protocol/rules/reader/SavefileRule.java @@ -27,11 +27,13 @@ public class SavefileRule extends ProtocolReader { private static final int FILE_SIZE = 1; // Index file size. private ProtocolRepository protocolRep; + private String storagePath; // Constructor - public SavefileRule(ProtocolRepository protocolRep) { + public SavefileRule(ProtocolRepository protocolRep, String storagePath) { super(NAME, PATTERN); this.protocolRep = protocolRep; + this.storagePath = storagePath; } public class Result extends ProtocolResult { @@ -52,7 +54,7 @@ public class SavefileRule extends ProtocolReader { System.out.printf("Sauvegarde du fichier : %s %d\n", filename, size); try { - FileReceiver fileReceiver = new FileReceiver("D:\\"); //"/home/benjamin/ffe"); + FileReceiver fileReceiver = new FileReceiver(storagePath); // "D:\\"); //"/home/benjamin/ffe"); String key = AES_GCM.generateSecretKey(); String iv = AES_GCM.generateIV(); diff --git a/app/src/main/java/lightcontainer/storage/Repository.java b/app/src/main/java/lightcontainer/storage/Repository.java index ecf6579..bb8b6da 100644 --- a/app/src/main/java/lightcontainer/storage/Repository.java +++ b/app/src/main/java/lightcontainer/storage/Repository.java @@ -114,4 +114,12 @@ public class Repository { public String getUserPasswordSalt(String login) { return appData.getUserPasswordSalt(login); } + + /** + * Méthode permettant de récupérer le chemin de sauvegarde des fichiers + * @return + */ + public String getStoragePath() { + return null; + } } diff --git a/app/src/main/resources/appdata.json b/app/src/main/resources/appdata.json index 67faaa8..4a9ff14 100644 --- a/app/src/main/resources/appdata.json +++ b/app/src/main/resources/appdata.json @@ -4,6 +4,7 @@ "multicast_port": 15502, "network_interface": "My network interface", "tls": true, + "storagePath": "/home/benjamin/ffe", "users": [ { "name": "benjamin",