-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use TransportPaths class instead of static path variables (#354)
Co-authored-by: Darren Shen <[email protected]>
- Loading branch information
Showing
8 changed files
with
72 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
bundle-core/src/main/java/net/discdd/pathutils/TransportPaths.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package net.discdd.pathutils; | ||
|
||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.logging.Logger; | ||
import static java.util.logging.Level.SEVERE; | ||
|
||
// BundleTransport | ||
// |_ files | ||
// |_ BundelSecurity (TO-DO) | ||
// |_ Server_Keys - server public keys | ||
// |_ Transport_Keys - transport key pairs | ||
// |_ BundleTransmission | ||
// |_ client - bundles to send to client + recencyBlob | ||
// |_ server - bundles to send to server | ||
|
||
public class TransportPaths{ | ||
private static final Logger logger = Logger.getLogger(TransportPaths.class.getName()); | ||
|
||
public final Path toClientPath; | ||
|
||
public final Path toServerPath; | ||
|
||
public TransportPaths(Path rootDir){ | ||
this.toClientPath = rootDir.resolve("BundleTransmission/client"); | ||
this.toServerPath = rootDir.resolve("BundleTransmission/server"); | ||
|
||
try { | ||
if (!Files.exists(toClientPath) || !Files.isDirectory(toServerPath)) { | ||
Files.createDirectories(toClientPath); | ||
Files.createDirectories(toServerPath); | ||
} | ||
} catch (Exception e) { | ||
logger.log(SEVERE, "Failed to create transport storage directories", e); | ||
} | ||
} | ||
} |