diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-03-22 01:30:27 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-03-22 01:30:27 +0000 |
commit | d0285733baffb1e92054ef74556c9e79a25be0fe (patch) | |
tree | cf3ddd12f5e51590e7abb8c21654f7b4ce92e4f9 /Build/source/texk/web2c | |
parent | 8e7bc120761bfc8920f8868f8e451118ea5f47a8 (diff) |
Support multi-byte characters in SyncTeX applications (from N. Abe) (win32 only).
git-svn-id: svn://tug.org/texlive/trunk@36584 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r-- | Build/source/texk/web2c/synctexdir/ChangeLog | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/synctexdir/synctex_parser_utils.c | 17 |
2 files changed, 22 insertions, 3 deletions
diff --git a/Build/source/texk/web2c/synctexdir/ChangeLog b/Build/source/texk/web2c/synctexdir/ChangeLog index bd74e66505f..1e195f355e5 100644 --- a/Build/source/texk/web2c/synctexdir/ChangeLog +++ b/Build/source/texk/web2c/synctexdir/ChangeLog @@ -1,3 +1,11 @@ +2015-03-22 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * synctex_parser_utils.c: Use WIN32API PathFindFileName() and + PathFindExtension() for last_component and last_extension, respectively, + in _synctex_strip_last_path_extension(), in order to support multi-byte + characters in SyncTeX applications (win32 only). + From Noriyuki Abe (2015-03-22). + 2015-03-19 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * synctex.c: Avoid minor memory leaks (win32 only). diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser_utils.c b/Build/source/texk/web2c/synctexdir/synctex_parser_utils.c index f8a9f6f9d61..961aa319432 100644 --- a/Build/source/texk/web2c/synctexdir/synctex_parser_utils.c +++ b/Build/source/texk/web2c/synctexdir/synctex_parser_utils.c @@ -67,6 +67,7 @@ authorization from the copyright holder. #ifdef SYNCTEX_WINDOWS #include <windows.h> +#include <shlwapi.h> /* Use shlwapi.lib */ #endif void *_synctex_malloc(size_t size) { @@ -116,6 +117,15 @@ void _synctex_strip_last_path_extension(char * string) { char * last_component = NULL; char * last_extension = NULL; char * next = NULL; +# if defined(SYNCTEX_WINDOWS) + last_component = PathFindFileName(string); + last_extension = PathFindExtension(string); + if(last_extension == NULL)return; + if(last_component == NULL)last_component = string; + if(last_extension>last_component){/* filter out paths like "my/dir/.hidden" */ + last_extension[0] = '\0'; + } +# else /* first we find the last path component */ if(NULL == (last_component = strstr(string,"/"))){ last_component = string; @@ -125,12 +135,12 @@ void _synctex_strip_last_path_extension(char * string) { last_component = next+1; } } -# if defined(SYNCTEX_WINDOWS) || defined(SYNCTEX_OS2) - /* On Windows, the '\' is also a path separator. */ +# if defined(SYNCTEX_OS2) + /* On OS2, the '\' is also a path separator. */ while((next = strstr(last_component,"\\"))){ last_component = next+1; } -# endif +# endif /* SYNCTEX_OS2 */ /* then we find the last path extension */ if((last_extension = strstr(last_component,"."))){ ++last_extension; @@ -142,6 +152,7 @@ void _synctex_strip_last_path_extension(char * string) { last_extension[0] = '\0'; } } +# endif /* SYNCTEX_WINDOWS */ } } |