+ /*
+ ** Find the user's mail storage directory, which is specified by
+ ** the `Path' profile component. Convert a relative path name
+ ** to an absolute one rooted in the home directory.
+ */
+ if ((cp = context_find("path")) == NULL) {
+ adios(NULL, "Your profile `%s' does not contain the required path entry.", defpath);
+ }
+ if (!*cp) {
+ adios(NULL, "The Path entry of your profile `%s' must be non-empty.", defpath);
+ }
+ if (*cp == '/') {
+ nd = cp;
+ } else {
+ snprintf(nd = buf, sizeof buf, "%s/%s", mypath, cp);
+ }
+ if (stat(nd, &st) == -1) {
+ if (errno != ENOENT) {
+ adios(nd, "error opening");
+ }
+ cp = concat("Your mail storage directory `", nd, "' doesn't exist; Create it? ", NULL);
+ if (!getanswer(cp)) {
+ adios(NULL, "Unable to access the mail storage directory `%s'", nd);
+ }
+ free(cp);
+ if (!makedir(nd)) {
+ adios(nd, "unable to create");
+ }
+ } else if ((st.st_mode & S_IFDIR) == 0) {
+ adios(NULL, "Your mail storage `%s' is not a directory", nd);
+ }
+ /*
+ ** Create the default folder (inbox)
+ */
+ cp = toabsdir(defaultfolder);
+ if (stat(cp, &st) == -1) {
+ if (!makedir(cp)) {
+ adios(cp, "Unable to create the default folder");
+ }
+ } else if ((st.st_mode & S_IFDIR) == 0) {
+ adios(NULL, "The default folder `%s' is not a directory", cp);
+ }