Files
HW-10-Socket-Programming/src/main/java/com/university/chat/Server/FileManager.java
T
2026-06-12 12:18:48 +03:30

26 lines
792 B
Java

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);
}
}