]>
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>
18 static char *cvsid
= "\n%%% $Id$\n";
27 mkdir_p (int isadir
, const char *in_path
)
29 char saved_char
, *slash
= 0;
32 char path
[strlen (in_path
) + 1];
33 strcpy (path
, in_path
);
35 d
= GetFileAttributes (path
);
36 if (d
!= 0xffffffff && d
& FILE_ATTRIBUTE_DIRECTORY
)
41 if (CreateDirectory (path
, 0))
43 gse
= GetLastError ();
44 if (gse
!= ERROR_PATH_NOT_FOUND
&& gse
!= ERROR_FILE_NOT_FOUND
)
46 if (gse
== ERROR_ALREADY_EXISTS
)
48 fprintf (stderr
, "warning: deleting \"%s\" so I can make a directory there\n",
50 if (DeleteFileA (path
))
51 return mkdir_p (isadir
, path
);
57 for (c
= path
; *c
; c
++)
61 if (*c
== '/' || *c
== '\\')
70 if (mkdir_p (1, path
))
80 return mkdir_p (isadir
, path
);
This page took 0.038023 seconds and 5 git commands to generate.