diff options
author | Bardur Arantsson <bardur@scientician.net> | 2014-12-23 17:19:34 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2014-12-23 17:45:36 +0100 |
commit | c99353f0823cc3d34d18d4453a1dc015130b50c6 (patch) | |
tree | fd29f86b6f8640ecf0dcecc0cad25ee3cb54aa29 /src/main.c | |
parent | a44d5bc11bf6d7049d75169ff81c20bec96f996c (diff) |
Move private_check_user_directory() to modules.cc
We need to move it out of main.c to support our test harness.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 40 |
1 files changed, 0 insertions, 40 deletions
@@ -44,46 +44,6 @@ static void quit_hook(cptr s) /* - * Check and create if needed the directory dirpath - */ -bool_ private_check_user_directory(cptr dirpath) -{ - /* Is this used anywhere else in *bands? */ - struct stat stat_buf; - - int ret; - - /* See if it already exists */ - ret = stat(dirpath, &stat_buf); - - /* It does */ - if (ret == 0) - { - /* Now we see if it's a directory */ - if ((stat_buf.st_mode & S_IFMT) == S_IFDIR) return (TRUE); - - /* - * Something prevents us from create a directory with - * the same pathname - */ - return (FALSE); - } - - /* No - this maybe the first time. Try to create a directory */ - else - { - /* Create the ~/.ToME directory */ - ret = mkdir(dirpath, 0700); - - /* An error occured */ - if (ret == -1) return (FALSE); - - /* Success */ - return (TRUE); - } -} - -/* * Check existence of ".ToME/" directory in the user's * home directory or try to create it if it doesn't exist. * Returns FALSE if all the attempts fail. |