2 * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
4 * $Id: createDirectory.c,v 1.3 1998/12/02 13:27:16 simonm Exp $
6 * createDirectory Runtime Support}
12 #ifdef HAVE_SYS_TYPES_H
13 #include <sys/types.h>
16 #ifdef HAVE_SYS_STAT_H
27 while((rc = mkdir(path, 0777)) != 0) {
36 ghc_errtype = ERR_NOSUCHTHING;
37 ghc_errstr = "no path to directory";
40 if (stat(path, &sb) != 0) {
41 ghc_errtype = ERR_OTHERERROR;
42 ghc_errstr = "cannot stat existing file";
44 if (S_ISDIR(sb.st_mode)) {
45 ghc_errtype = ERR_ALREADYEXISTS;
46 ghc_errstr = "directory already exists";
48 ghc_errtype = ERR_INAPPROPRIATETYPE;
49 ghc_errstr = "file already exists";