Add base files
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.university.chat.Server;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class FileManager {
|
||||
|
||||
private static final String BASE_DIR = "server_data";
|
||||
|
||||
public static void createUserFolders(String username) throws IOException {
|
||||
Path userPath = Paths.get(BASE_DIR, username);
|
||||
Files.createDirectories(userPath.resolve("received"));
|
||||
Files.createDirectories(userPath.resolve("sent"));
|
||||
}
|
||||
|
||||
public static Path getReceivedPath(String username, String filename) {
|
||||
return Paths.get(BASE_DIR, username, "received", filename);
|
||||
}
|
||||
|
||||
public static Path getSentPath(String username, String filename) {
|
||||
return Paths.get(BASE_DIR, username, "sent", filename);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user