summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/lib/texmfmp.c
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2019-05-14 04:53:31 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2019-05-14 04:53:31 +0000
commitdaa665384dc7dcbb498d93ff7491d1dc77b957c4 (patch)
tree3a23ff1d5b8baf4c6423386ff50c5d55807aefd1 /Build/source/texk/web2c/lib/texmfmp.c
parent0d55da2b59a243c4531bc121577f2bdc15857f98 (diff)
improve support of non-ascii file names (Windows only)
git-svn-id: svn://tug.org/texlive/trunk@51119 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/lib/texmfmp.c')
-rw-r--r--Build/source/texk/web2c/lib/texmfmp.c34
1 files changed, 32 insertions, 2 deletions
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 <sys/stat.h>
+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