diff --git a/CHANGES.current b/CHANGES.current index 511486dcc..e84bb7ad5 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,6 +1,11 @@ Version 1.3.41 (in progress) ============================ +2010-02-08: wsfulton + Fix #1807329 - When Makefile dependencies are being generated using the -M family of options + on Windows, the file paths have been corrected to use single backslashes rather than double + backslashes as path separators. + 2010-02-06: wsfulton Fix #2918902 - language specific files not being generated in correct directory on Windows when using forward slashes for -o, for example: diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx index 6a038f1ff..7dbb4f486 100644 --- a/Source/Modules/main.cxx +++ b/Source/Modules/main.cxx @@ -1022,7 +1022,7 @@ int SWIG_main(int argc, char *argv[], Language *l) { if (lang_config) { Printf(fs, "\n%%include <%s>\n", lang_config); } - Printf(fs, "%%include(maininput=\"%s\") \"%s\"\n", Swig_filename_escape(input_file), Swig_last_file()); + Printf(fs, "%%include(maininput=\"%s\") \"%s\"\n", Swig_filename_escape(input_file), Swig_filename_escape(Swig_last_file())); for (i = 0; i < Len(libfiles); i++) { Printf(fs, "\n%%include \"%s\"\n", Getitem(libfiles, i)); } diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index 7958b4e09..c4c5d6861 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -625,7 +625,7 @@ unterm: /* ----------------------------------------------------------------------------- * DOH *get_filename(DOH *str) * - * Read a filename from str. A filename can be enclose in quotes, angle brackets, + * Read a filename from str. A filename can be enclosed in quotes, angle brackets, * or bare. * ----------------------------------------------------------------------------- */ @@ -652,6 +652,7 @@ static String *get_filename(String *str, int *sysfile) { if (isspace(c)) Ungetc(c, str); } + Swig_filename_unescape(fn); Swig_filename_correct(fn); Seek(fn, 0, SEEK_SET); return fn; @@ -1593,9 +1594,9 @@ String *Preprocessor_parse(String *s) { s1 = cpp_include(fn, sysfile); if (s1) { if (include_all) - Printf(ns, "%%includefile \"%s\" [\n", Swig_last_file()); + Printf(ns, "%%includefile \"%s\" [\n", Swig_filename_escape(Swig_last_file())); else if (import_all) { - Printf(ns, "%%importfile \"%s\" [\n", Swig_last_file()); + Printf(ns, "%%importfile \"%s\" [\n", Swig_filename_escape(Swig_last_file())); push_imported(); } @@ -1732,7 +1733,7 @@ String *Preprocessor_parse(String *s) { char *dirname; add_chunk(ns, chunk, allow); copy_location(s, chunk); - Printf(ns, "%sfile%s \"%s\" [\n", decl, opt, Swig_last_file()); + Printf(ns, "%sfile%s \"%s\" [\n", decl, opt, Swig_filename_escape(Swig_last_file())); if (Equal(decl, kpp_dimport)) { push_imported(); } diff --git a/Source/Swig/include.c b/Source/Swig/include.c index f42eb5d45..dd4c7e020 100644 --- a/Source/Swig/include.c +++ b/Source/Swig/include.c @@ -184,9 +184,8 @@ static FILE *Swig_open_file(const_String_or_char_ptr name, int sysfile, int use_ } if (f) { Delete(lastpath); - lastpath = Swig_filename_escape(filename); + lastpath = filename; } - Delete(filename); return f; } @@ -244,7 +243,7 @@ static String *Swig_include_any(const_String_or_char_ptr name, int sysfile) { str = Swig_read_file(f); fclose(f); Seek(str, 0, SEEK_SET); - file = Copy(lastpath); + file = Copy(Swig_last_file()); Setfile(str, file); Delete(file); Setline(str, 1); diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c index 3a42ab682..1fd8f7f90 100644 --- a/Source/Swig/misc.c +++ b/Source/Swig/misc.c @@ -159,12 +159,25 @@ void Swig_filename_correct(String *filename) { String *Swig_filename_escape(String *filename) { String *adjusted_filename = Copy(filename); #if defined(_WIN32) /* Note not on Cygwin else filename is displayed with double '/' */ - Replaceall(adjusted_filename, "\\\\", "\\"); /* remove double '\' in case any already present */ - Replaceall(adjusted_filename, "\\", "\\\\"); + Replaceall(adjusted_filename, "\\\\", "\\"); /* remove double '\' in case any already present */ + Replaceall(adjusted_filename, "\\", "\\\\"); #endif return adjusted_filename; } +/* ----------------------------------------------------------------------------- + * Swig_filename_unescape() + * + * Remove double backslash escaping in filename - for Windows + * ----------------------------------------------------------------------------- */ + +void Swig_filename_unescape(String *filename) { + (void)filename; +#if defined(_WIN32) + Replaceall(filename, "\\\\", "\\"); +#endif +} + /* ----------------------------------------------------------------------------- * Swig_string_escape() * diff --git a/Source/Swig/swig.h b/Source/Swig/swig.h index 6abe6f5c5..4bd08be3a 100644 --- a/Source/Swig/swig.h +++ b/Source/Swig/swig.h @@ -294,8 +294,9 @@ extern int ParmList_is_compactdefargs(ParmList *p); extern void Swig_banner(File *f); extern void Swig_banner_target_lang(File *f, const_String_or_char_ptr commentchar); extern String *Swig_strip_c_comments(const String *s); - extern String *Swig_filename_escape(String *filename); extern void Swig_filename_correct(String *filename); + extern String *Swig_filename_escape(String *filename); + extern void Swig_filename_unescape(String *filename); extern String *Swig_string_escape(String *s); extern String *Swig_string_mangle(const String *s); extern void Swig_scopename_split(const String *s, String **prefix, String **last);