ignore ':' in col 1 of vips7 paths

oh argh, we were mangling windows paths

see https://github.com/jcupitt/build-win32/issues/11
This commit is contained in:
John Cupitt 2015-10-13 14:21:17 +01:00
parent 368a74abcd
commit 9a4d82653c
2 changed files with 11 additions and 2 deletions

View File

@ -69,6 +69,8 @@
* -> c:\silly ""
* c:\silly
* -> c:\silly ""
* C:\fixtures\2569067123_aca715a2ee_o.jpg
* -> C:\fixtures\2569067123_aca715a2ee_o.jpg ""
*
* vips8 handles this in a much better way :(
*/
@ -109,7 +111,11 @@ im_filename_split( const char *path, char *name, char *mode )
break;
}
if( *p == ':' ) {
/* Ignore a ':' in column 1, it's probably a drive letter on a
* Windows path.
*/
if( *p == ':' &&
p - name != 1 ) {
vips_strncpy( mode, p + 1, FILENAME_MAX );
*p = '\0';
}

View File

@ -51,7 +51,10 @@ class TestIofuncs(unittest.TestCase):
""]],
["c:\\program files\\x:hello",
["c:\\program files\\x",
"hello"]]
"hello"]],
["C:\\fixtures\\2569067123_aca715a2ee_o.jpg",
["C:\\fixtures\\2569067123_aca715a2ee_o.jpg",
""]]
]
for case in cases: