mirror of
https://github.com/reactos/reactos.git
synced 2025-07-06 16:31:22 +00:00
reformat and simplify before adding functionality
svn path=/branches/xmlbuildsystem/; revision=14076
This commit is contained in:
parent
defea05242
commit
effadc5c83
1 changed files with 84 additions and 95 deletions
|
@ -10,41 +10,39 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32)
|
#define WIN_SEPARATOR_CHAR '\\'
|
||||||
#define DIR_SEPARATOR_CHAR '\\'
|
#define WIN_SEPARATOR_STRING "\\"
|
||||||
#define DIR_SEPARATOR_STRING "\\"
|
#define NIX_SEPARATOR_CHAR '/'
|
||||||
#define DOS_PATHS
|
#define NIX_SEPARATOR_STRING "/"
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#define DIR_SEPARATOR_CHAR WIN_SEPARATOR_CHAR
|
||||||
|
#define DIR_SEPARATOR_STRING WIN_SEPARATOR_STRING
|
||||||
|
#define BAD_SEPARATOR_CHAR NIX_SEPARATOR_CHAR
|
||||||
|
#define MKDIR(s) mkdir(s)
|
||||||
#else
|
#else
|
||||||
#define DIR_SEPARATOR_CHAR '/'
|
#define DIR_SEPARATOR_CHAR NIX_SEPARATOR_CHAR
|
||||||
#define DIR_SEPARATOR_STRING "/"
|
#define DIR_SEPARATOR_STRING NIX_SEPARATOR_STRING
|
||||||
#define UNIX_PATHS
|
#define BAD_SEPARATOR_CHAR WIN_SEPARATOR_CHAR
|
||||||
|
#define MKDIR(s) mkdir(s,0755)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char* convert_path(char* origpath)
|
char*
|
||||||
|
convert_path(char* origpath)
|
||||||
{
|
{
|
||||||
char* newpath;
|
char* newpath;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
//newpath = strdup(origpath);
|
|
||||||
newpath=malloc(strlen(origpath)+1);
|
newpath=malloc(strlen(origpath)+1);
|
||||||
strcpy(newpath,origpath);
|
strcpy(newpath,origpath);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (newpath[i] != 0)
|
while (newpath[i] != 0)
|
||||||
{
|
{
|
||||||
#ifdef UNIX_PATHS
|
if (newpath[i] == BAD_SEPARATOR_CHAR)
|
||||||
if (newpath[i] == '\\')
|
|
||||||
{
|
{
|
||||||
newpath[i] = '/';
|
newpath[i] = DIR_SEPARATOR_CHAR;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#ifdef DOS_PATHS
|
|
||||||
if (newpath[i] == '/')
|
|
||||||
{
|
|
||||||
newpath[i] = '\\';
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return(newpath);
|
return(newpath);
|
||||||
|
@ -58,20 +56,11 @@ int mkdir_p(char* path)
|
||||||
{
|
{
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
#ifdef UNIX_PATHS
|
if (MKDIR(path) != 0)
|
||||||
if (mkdir(path, 0755) != 0)
|
|
||||||
{
|
{
|
||||||
perror("Failed to create directory");
|
perror("Failed to create directory");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (mkdir(path) != 0)
|
|
||||||
{
|
|
||||||
perror("Failed to create directory");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (chdir(path) != 0)
|
if (chdir(path) != 0)
|
||||||
{
|
{
|
||||||
perror("Failed to change directory");
|
perror("Failed to change directory");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue