Fix #3127394 - use of network paths on Windows/MSys.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12322 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
24591490c2
commit
02750e80a3
2 changed files with 16 additions and 5 deletions
|
|
@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release.
|
||||||
Version 2.0.2 (in progress)
|
Version 2.0.2 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2010-12-06: wsfulton
|
||||||
|
Fix #3127394 - use of network paths on Windows/MSys.
|
||||||
|
|
||||||
2010-11-18: klickverbot
|
2010-11-18: klickverbot
|
||||||
[D] Added the D language module.
|
[D] Added the D language module.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,14 @@ String *Swig_new_subdirectory(String *basedirectory, String *subdirectory) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Swig_filename_correct(String *filename) {
|
void Swig_filename_correct(String *filename) {
|
||||||
(void)filename;
|
int network_path = 0;
|
||||||
|
if (Len(filename) >= 2) {
|
||||||
|
const char *fname = Char(filename);
|
||||||
|
if (fname[0] == '\\' && fname[1] == '\\')
|
||||||
|
network_path = 1;
|
||||||
|
if (fname[0] == '/' && fname[1] == '/')
|
||||||
|
network_path = 1;
|
||||||
|
}
|
||||||
#if defined(_WIN32) || defined(MACSWIG)
|
#if defined(_WIN32) || defined(MACSWIG)
|
||||||
/* accept Unix path separator on non-Unix systems */
|
/* accept Unix path separator on non-Unix systems */
|
||||||
Replaceall(filename, "/", SWIG_FILE_DELIMITER);
|
Replaceall(filename, "/", SWIG_FILE_DELIMITER);
|
||||||
|
|
@ -232,6 +239,9 @@ void Swig_filename_correct(String *filename) {
|
||||||
/* remove all duplicate file name delimiters */
|
/* remove all duplicate file name delimiters */
|
||||||
while (Replaceall(filename, SWIG_FILE_DELIMITER SWIG_FILE_DELIMITER, SWIG_FILE_DELIMITER)) {
|
while (Replaceall(filename, SWIG_FILE_DELIMITER SWIG_FILE_DELIMITER, SWIG_FILE_DELIMITER)) {
|
||||||
}
|
}
|
||||||
|
/* Network paths can start with a double slash on Windows - unremove the duplicate slash we just removed */
|
||||||
|
if (network_path)
|
||||||
|
Insert(filename, 0, SWIG_FILE_DELIMITER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
@ -242,10 +252,8 @@ void Swig_filename_correct(String *filename) {
|
||||||
|
|
||||||
String *Swig_filename_escape(String *filename) {
|
String *Swig_filename_escape(String *filename) {
|
||||||
String *adjusted_filename = Copy(filename);
|
String *adjusted_filename = Copy(filename);
|
||||||
|
Swig_filename_correct(adjusted_filename);
|
||||||
#if defined(_WIN32) /* Note not on Cygwin else filename is displayed with double '/' */
|
#if defined(_WIN32) /* Note not on Cygwin else filename is displayed with double '/' */
|
||||||
/* remove all double '\' in case any already present */
|
|
||||||
while (Replaceall(adjusted_filename, "\\\\", "\\")) {
|
|
||||||
}
|
|
||||||
Replaceall(adjusted_filename, "\\", "\\\\");
|
Replaceall(adjusted_filename, "\\", "\\\\");
|
||||||
#endif
|
#endif
|
||||||
return adjusted_filename;
|
return adjusted_filename;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue