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