mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
convert \ to / in paths in windows
This commit is contained in:
parent
b928f94440
commit
2ba8e871f3
3 changed files with 27 additions and 7 deletions
|
@ -108,6 +108,13 @@ extern FILE *yyin;
|
|||
int yyparse (void);
|
||||
extern int yydebug;
|
||||
|
||||
#ifdef _WIN32
|
||||
char *fix_backslash (const char *path);
|
||||
#define NORMALIZE(x) fix_backslash (x)
|
||||
#else
|
||||
#define NORMALIZE(x) x
|
||||
#endif
|
||||
|
||||
#define ALLOC(s, t, n, v) \
|
||||
do { \
|
||||
if (!free_##n) { \
|
||||
|
|
|
@ -169,7 +169,7 @@ DecodeArgs (int argc, char **argv)
|
|||
!= EOF) {
|
||||
switch (c) {
|
||||
case 1: // ordinary file
|
||||
add_file (optarg);
|
||||
add_file (NORMALIZE (optarg));
|
||||
break;
|
||||
case 'o':
|
||||
if (options.output_file) {
|
||||
|
@ -177,14 +177,14 @@ DecodeArgs (int argc, char **argv)
|
|||
this_program);
|
||||
exit (1);
|
||||
} else {
|
||||
options.output_file = save_string (optarg);
|
||||
options.output_file = save_string (NORMALIZE (optarg));
|
||||
}
|
||||
break;
|
||||
case 'l': // lib file
|
||||
add_file (va ("-l%s", optarg));
|
||||
add_file (va ("-l%s", NORMALIZE (optarg)));
|
||||
break;
|
||||
case 'L':
|
||||
linker_add_path (optarg);
|
||||
linker_add_path (NORMALIZE (optarg));
|
||||
break;
|
||||
case 'h': // help
|
||||
usage (0);
|
||||
|
@ -194,10 +194,10 @@ DecodeArgs (int argc, char **argv)
|
|||
exit (0);
|
||||
break;
|
||||
case 's': // src dir
|
||||
sourcedir = save_string (optarg);
|
||||
sourcedir = save_string (NORMALIZE (optarg));
|
||||
break;
|
||||
case 'P': // progs-src
|
||||
progs_src = save_string (optarg);
|
||||
progs_src = save_string (NORMALIZE (optarg));
|
||||
break;
|
||||
case 'p':
|
||||
options.strip_path = atoi (optarg);
|
||||
|
|
|
@ -124,6 +124,19 @@ save_string (const char *str)
|
|||
return s;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
char *
|
||||
fix_backslash (char *path)
|
||||
{
|
||||
char *s;
|
||||
|
||||
for (s = path; *s; s++)
|
||||
if (*s == '\\')
|
||||
*s = '/';
|
||||
return path;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
InitData (void)
|
||||
{
|
||||
|
@ -729,7 +742,7 @@ main (int argc, char **argv)
|
|||
|
||||
start = Sys_DoubleTime ();
|
||||
|
||||
this_program = argv[0];
|
||||
this_program = NORMALIZE (argv[0]);
|
||||
|
||||
DecodeArgs (argc, argv);
|
||||
|
||||
|
|
Loading…
Reference in a new issue