diff options
author | Bardur Arantsson <bardur@scientician.net> | 2014-11-20 01:38:26 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2014-11-20 01:47:52 +0100 |
commit | bf70e894f195c5d408e3ee26acc2283236349235 (patch) | |
tree | f59d662d597d1a70068ec428c80d2fc46a3e3fe3 /src/main.c | |
parent | 4d2f69c425f64e3dfcbe613a85d3b32d90f6136d (diff) |
Don't lie about path if we fail to auto-create "save" directory
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 35 |
1 files changed, 17 insertions, 18 deletions
@@ -88,7 +88,7 @@ bool_ private_check_user_directory(cptr dirpath) * home directory or try to create it if it doesn't exist. * Returns FALSE if all the attempts fail. */ -static bool_ check_create_user_dir(void) +static void init_save_dir(void) { char dirpath[1024]; char versionpath[1024]; @@ -101,7 +101,20 @@ static bool_ check_create_user_dir(void) strcpy(savepath, versionpath); strcat(savepath, "/save"); - return private_check_user_directory(dirpath) && private_check_user_directory(versionpath) && private_check_user_directory(savepath); + if (!private_check_user_directory(dirpath)) + { + quit_fmt("Cannot create directory '%s'", dirpath); + } + + if (!private_check_user_directory(versionpath)) + { + quit_fmt("Cannot create directory '%s'", versionpath); + } + + if (!private_check_user_directory(savepath)) + { + quit_fmt("Cannot create directory '%s'", savepath); + } } @@ -139,22 +152,8 @@ int main(int argc, char *argv[]) /* Acquire the "user name" as a default player name */ user_name(player_name, player_uid); - - /* - * On multiuser systems, users' private directories are - * used to store pref files, chardumps etc. - */ - { - bool_ ret; - - /* Create a directory for the user's files */ - ret = check_create_user_dir(); - - /* Oops */ - if (ret == FALSE) quit("Cannot create directory " PRIVATE_USER_PATH); - } - - + /* Make sure save directory exists */ + init_save_dir(); /* Process the command line arguments */ |