From 9a4d82653c708004789000797f97ca60f2931877 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 13 Oct 2015 14:21:17 +0100 Subject: [PATCH] ignore ':' in col 1 of vips7 paths oh argh, we were mangling windows paths see https://github.com/jcupitt/build-win32/issues/11 --- libvips/deprecated/vips7compat.c | 8 +++++++- test/test_iofuncs.py | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index 13e5914d..41a58c92 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -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'; } diff --git a/test/test_iofuncs.py b/test/test_iofuncs.py index 0f1bba44..2182cf9d 100755 --- a/test/test_iofuncs.py +++ b/test/test_iofuncs.py @@ -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: