creating spool dir if not exist

This commit is contained in:
Benedikt Galbavy 2023-10-18 22:56:24 +02:00
parent 5124b73802
commit c3bb33cf69
2 changed files with 8 additions and 4 deletions

View File

@ -27,4 +27,6 @@ $(BUILD_DIR)/%.o: %.cpp
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -rf $(BUILD_DIR) twmailer-client twmailer-server
rm -rf $(BUILD_DIR) twmailer-client twmailer-server
.PHONY: all client server clean

View File

@ -64,13 +64,15 @@ user_handler* user_handler::instancePtr = nullptr;
int main (int argc, char* argv[])
{
if (argc < 3 ||
!isInteger(argv[1]) ||
!fs::is_directory(argv[2])
) {
!isInteger(argv[1])) {
printUsage();
return EXIT_FAILURE;
}
if (!fs::is_directory(argv[2])) {
fs::create_directory(argv[2]);
}
fs::path spool_dir = fs::path(argv[2]);
fs::create_directory(spool_dir/"users");
fs::create_directory(spool_dir/"messages");