From daa665384dc7dcbb498d93ff7491d1dc77b957c4 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Tue, 14 May 2019 04:53:31 +0000 Subject: improve support of non-ascii file names (Windows only) git-svn-id: svn://tug.org/texlive/trunk@51119 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/lib/texmfmp.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'Build/source/texk/web2c/lib/texmfmp.c') diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index 0e372be2aa8..a7252ee1992 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -147,7 +147,7 @@ char *generic_synctex_get_current_name (void) } #endif -#ifdef WIN32 +#ifdef _WIN32 #if !IS_pTeX FILE *Poptr; #endif @@ -162,11 +162,34 @@ int fsyscp_stat(const char *path, struct stat *buffer) int ret; wpath = get_wstring_from_mbstring(file_system_codepage, path, wpath = NULL); + if (wpath == NULL) + return -1; ret = _wstat(wpath, buffer); free(wpath); return ret; } -#endif /* WIN32 */ +#include +int fsyscp_dir_p(char *path) +{ + struct stat stats; + int ret; + + ret = fsyscp_stat(path, &stats) == 0 && S_ISDIR (stats.st_mode); + return ret; +} +int fsyscp_access(const char *path, int mode) +{ + wchar_t *wpath; + int ret; + wpath = get_wstring_from_mbstring(file_system_codepage, + path, wpath = NULL); + if (wpath == NULL) + return -1; + ret = _waccess(wpath, mode); + free(wpath); + return ret; +} +#endif /* _WIN32 */ #if defined(TeX) || (defined(MF) && defined(WIN32)) static int @@ -3094,6 +3117,13 @@ void initstarttime(void) } } +#if defined(_WIN32) +#undef access +#undef dir_p +#define access fsyscp_access +#define dir_p fsyscp_dir_p +#endif /* _WIN32 */ + /* Search for an input file. If -output-directory is specified look there first. If that fails, do the regular kpse search. */ string -- cgit v1.2.3