]>
cygwin.com Git - cygwin-apps/setup.git/blob - mkdir.cc
2 * Copyright (c) 2000, Red Hat, Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * A copy of the GNU General Public License can be found at
12 * Written by DJ Delorie <dj@cygnus.com>
19 static const char *cvsid
=
30 mkdir_p (int isadir
, const char *in_path
)
32 char saved_char
, *slash
= 0;
35 char path
[strlen (in_path
) + 1];
36 strcpy (path
, in_path
);
38 d
= GetFileAttributes (path
);
39 if (d
!= 0xffffffff && d
& FILE_ATTRIBUTE_DIRECTORY
)
44 if (CreateDirectory (path
, 0))
46 gse
= GetLastError ();
47 if (gse
!= ERROR_PATH_NOT_FOUND
&& gse
!= ERROR_FILE_NOT_FOUND
)
49 if (gse
== ERROR_ALREADY_EXISTS
)
52 "warning: deleting \"%s\" so I can make a directory there\n",
54 if (DeleteFileA (path
))
55 return mkdir_p (isadir
, path
);
61 for (c
= path
; *c
; c
++)
65 if (*c
== '/' || *c
== '\\')
72 // Trying to create a drive... It's time to give up.
73 if (((slash
- path
) == 2) && (path
[1] == ':'))
78 if (mkdir_p (1, path
))
89 return mkdir_p (isadir
, path
);
This page took 0.038474 seconds and 5 git commands to generate.