mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 14:30:57 +00:00
2003-08-30 Casper S. Hornstrup <chorns@users.sourceforge.net>
* tools/rmkdir.c: Create all (sub)directories in path on win32. svn path=/trunk/; revision=5929
This commit is contained in:
parent
8d9c42a241
commit
b6a3594f0e
2 changed files with 22 additions and 8 deletions
|
@ -1,3 +1,7 @@
|
|||
2003-08-30 Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
|
||||
* tools/rmkdir.c: Create all (sub)directories in path on win32.
|
||||
|
||||
2003-08-30 Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
|
||||
* bootdata/packages/reactos.dff: Don't include winmm.dll in reactos.cab.
|
||||
|
|
|
@ -2,6 +2,16 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef UNIX_PATHS
|
||||
#define DIR_SEPARATOR_CHAR '/'
|
||||
#define DIR_SEPARATOR_STRING "/"
|
||||
#else
|
||||
#ifdef DOS_PATHS
|
||||
#define DIR_SEPARATOR_CHAR '\\'
|
||||
#define DIR_SEPARATOR_STRING "\\"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
char* convert_path(char* origpath)
|
||||
{
|
||||
char* newpath;
|
||||
|
@ -76,26 +86,26 @@ int main(int argc, char* argv[])
|
|||
|
||||
path1 = convert_path(argv[1]);
|
||||
|
||||
if (isalpha(path1[0]) && path1[1] == ':' && path1[2] == '/')
|
||||
if (isalpha(path1[0]) && path1[1] == ':' && path1[2] == DIR_SEPARATOR_CHAR)
|
||||
{
|
||||
csec = strtok(path1, "/");
|
||||
csec = strtok(path1, DIR_SEPARATOR_STRING);
|
||||
chdir(csec);
|
||||
csec = strtok(NULL, "/");
|
||||
csec = strtok(NULL, DIR_SEPARATOR_STRING);
|
||||
}
|
||||
else if (path1[0] == '/')
|
||||
else if (path1[0] == DIR_SEPARATOR_CHAR)
|
||||
{
|
||||
chdir("/");
|
||||
csec = strtok(path1, "/");
|
||||
chdir(DIR_SEPARATOR_STRING);
|
||||
csec = strtok(path1, DIR_SEPARATOR_STRING);
|
||||
}
|
||||
else
|
||||
{
|
||||
csec = strtok(path1, "/");
|
||||
csec = strtok(path1, DIR_SEPARATOR_STRING);
|
||||
}
|
||||
|
||||
while (csec != NULL)
|
||||
{
|
||||
mkdir_p(csec);
|
||||
csec = strtok(NULL, "/");
|
||||
csec = strtok(NULL, DIR_SEPARATOR_STRING);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
|
|
Loading…
Reference in a new issue