OSDN Git Service

Merge branch 'develop' into macos-develop
[hengbandforosx/hengbandosx.git] / src / main.cpp
index e0ab108..ea4f35b 100644 (file)
@@ -28,7 +28,6 @@
 #include "view/display-scores.h"
 #include "wizard/spoiler-util.h"
 #include "wizard/wizard-spoiler.h"
-#include <filesystem>
 #include <string>
 
 /*
@@ -44,7 +43,7 @@
  * all the others use this file for their "main()" function.
  */
 
-#ifndef WINDOWS
+#if !defined(WINDOWS) && !defined(MACH_O_COCOA)
 /*
  * A hook for "quit()".
  *
@@ -68,30 +67,6 @@ static void quit_hook(concptr s)
     }
 }
 
-/*
- * Set the stack size and overlay buffer (see main-286.c")
- */
-#ifdef PRIVATE_USER_PATH
-
-/*
- * Create an ".angband/" directory in the users home directory.
- *
- * ToDo: Add error handling.
- * ToDo: Only create the directories when actually writing files.
- */
-static void create_user_dir(void)
-{
-    const auto &dirpath = path_parse(PRIVATE_USER_PATH);
-    const auto &dir_str = dirpath.string();
-    mkdir(dir_str.data(), 0700);
-
-    const auto &subdirpath = path_build(dirpath, VARIANT_NAME);
-    const auto &subdir_str = subdirpath.string();
-    mkdir(subdir_str.data(), 0700);
-}
-
-#endif /* PRIVATE_USER_PATH */
-
 static void init_stuff()
 {
     char libpath[1024]{};
@@ -101,7 +76,7 @@ static void init_stuff()
         strcat(libpath, PATH_SEP);
     }
 
-    init_file_paths(libpath);
+    init_file_paths(libpath, libpath);
 }
 
 /*
@@ -280,7 +255,8 @@ int main(int argc, char *argv[])
 #ifdef SET_UID
     user_name(p_ptr->name, ids.get_user_id());
 #ifdef PRIVATE_USER_PATH
-    create_user_dir();
+    /* Create a directory for the user's files; handled by init.c. */
+    create_needed_dirs();
 #endif /* PRIVATE_USER_PATH */
 #endif /* SET_UID */