summaryrefslogtreecommitdiff
path: root/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2024-02-10 06:55:23 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2024-02-10 06:55:23 +0000
commit0357cc55904fda095727bb30f07b68dbf3439f8e (patch)
tree4dfe670d69c9d538606e6d49fe29b506c05e5975 /Build/source/libs/xpdf/xpdf-src/goo/gfile.cc
parent28c5129fe7864e1005edc90cf737372ba1bc78c7 (diff)
xpdf 4.05
git-svn-id: svn://tug.org/texlive/trunk@69765 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/xpdf/xpdf-src/goo/gfile.cc')
-rw-r--r--Build/source/libs/xpdf/xpdf-src/goo/gfile.cc25
1 files changed, 24 insertions, 1 deletions
diff --git a/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc b/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc
index c2e7512e188..e1fdf297689 100644
--- a/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc
+++ b/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc
@@ -418,6 +418,18 @@ GBool pathIsFile(const char *path) {
#endif
}
+GBool pathIsDir(const char *path) {
+#ifdef _WIN32
+ wchar_t wPath[winMaxLongPath + 1];
+ fileNameToUCS2(path, wPath, winMaxLongPath + 1);
+ DWORD attr = GetFileAttributesW(wPath);
+ return attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY);
+#else
+ struct stat statBuf;
+ return stat(path, &statBuf) == 0 && S_ISDIR(statBuf.st_mode);
+#endif
+}
+
time_t getModTime(char *fileName) {
#ifdef _WIN32
//~ should implement this, but it's (currently) only used in xpdf
@@ -602,6 +614,17 @@ GString *fileNameToUTF8(wchar_t *path) {
return s;
}
+GString *fileNameMultiByteToUTF8(char *path) {
+ wchar_t fileNameW[winMaxLongPath + 1];
+ if (MultiByteToWideChar(CP_OEMCP, 0, path, -1,
+ fileNameW, sizeof(fileNameW) / sizeof(wchar_t))) {
+ return fileNameToUTF8(fileNameW);
+ } else {
+ // shouldn't happen, but just in case...
+ return new GString(path);
+ }
+}
+
wchar_t *fileNameToUCS2(const char *path, wchar_t *out, size_t outSize) {
const char *p;
size_t i;
@@ -680,7 +703,7 @@ void readWindowsShortcut(wchar_t *wPath, size_t wPathSize) {
}
hres = persistFile->Load(wPath, STGM_READ);
if (FAILED(hres)) {
- fprintf(stderr, "IPersistFile.Load failed: 0x%08x\n", hres);
+ fprintf(stderr, "IPersistFile.Load failed: 0x%08lx\n", hres);
exit(1);
}
wchar_t target[winMaxLongPath + 1];