2 * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
4 * $Id: createDirectory.c,v 1.4 1999/03/01 09:03:37 sof Exp $
6 * createDirectory Runtime Support}
12 #ifdef HAVE_SYS_TYPES_H
13 #include <sys/types.h>
16 #ifdef HAVE_SYS_STAT_H
20 #if defined(mingw32_TARGET_OS)
21 #define mkDir(nm,p) mkdir(nm)
23 #define mkDir(nm,p) mkdir(nm,p)
33 while((rc = mkDir(path, 0777)) != 0) {
42 ghc_errtype = ERR_NOSUCHTHING;
43 ghc_errstr = "no path to directory";
46 if (stat(path, &sb) != 0) {
47 ghc_errtype = ERR_OTHERERROR;
48 ghc_errstr = "cannot stat existing file";
50 if (S_ISDIR(sb.st_mode)) {
51 ghc_errtype = ERR_ALREADYEXISTS;
52 ghc_errstr = "directory already exists";
54 ghc_errtype = ERR_INAPPROPRIATETYPE;
55 ghc_errstr = "file already exists";