diff options
-rw-r--r-- | Build/source/texk/dviljk/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/dviljk/dvi2xx.c | 28 |
2 files changed, 9 insertions, 24 deletions
diff --git a/Build/source/texk/dviljk/ChangeLog b/Build/source/texk/dviljk/ChangeLog index b4f9287dcee..c6a8a9c74cf 100644 --- a/Build/source/texk/dviljk/ChangeLog +++ b/Build/source/texk/dviljk/ChangeLog @@ -1,5 +1,10 @@ 2012-10-02 Peter Breitenlohner <peb@mppmu.mpg.de> + * dvi2xx.c [WIN32]: Drop is_dir() and handle tmp_dir differently + (from Akira). + +2012-10-02 Peter Breitenlohner <peb@mppmu.mpg.de> + * dvi2xx.c [WIN32]: Define is_dir() and handle tmp_dir (from Akira). Use IS_DIR_SEP_CH(). * dvi2xx.h: #include <kpathsea/c-pathch.h>. diff --git a/Build/source/texk/dviljk/dvi2xx.c b/Build/source/texk/dviljk/dvi2xx.c index a19c5f2de01..b58e85ab0a7 100644 --- a/Build/source/texk/dviljk/dvi2xx.c +++ b/Build/source/texk/dviljk/dvi2xx.c @@ -121,25 +121,6 @@ VisChar(unsigned char c) } #endif -#ifdef WIN32 -static int is_dir(const char *buff) -{ - HANDLE h; - WIN32_FIND_DATA w32fd; - - if(((h = FindFirstFile(buff, &w32fd)) - != INVALID_HANDLE_VALUE) && - (w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { - FindClose(h); - return (1); - } - else { - FindClose(h); - return (0); - } -} -#endif - /**********************************************************************/ /******************************* main *******************************/ @@ -4040,7 +4021,7 @@ void DoSpecial(char *str, int n) if ( tmp_dir[0] == '\0' ) { const char * base_dir, * base_base; #ifdef WIN32 -# define def_tmp "c:/tmp" + char *def_tmp = concat (getenv ("WINDIR"), "/Temp"); if ( (base_dir = getenv("TMPDIR")) == NULL && (base_dir = getenv("TMP")) == NULL && (base_dir = getenv("TEMP")) == NULL ) { @@ -4050,7 +4031,7 @@ void DoSpecial(char *str, int n) #endif base_dir = def_tmp; } else if ( strlen(base_dir) > STRSIZE - sizeof("/dviljkXXXXXX/include.pcl") ) { - Warning ("TMPDIR %s is too long, using " def_tmp " instead", base_dir); + Warning ("TMPDIR %s is too long, using %s instead", base_dir, def_tmp); base_dir = def_tmp; } /* FIXME: Actually, we would need a function to sanitize base_dir here. @@ -4064,11 +4045,10 @@ void DoSpecial(char *str, int n) Warning ("Feeling naughty, do we? %s is no temporary directory, dude", base_dir); base_dir = def_tmp; } + strcpy (tmp_dir, base_dir); #ifdef WIN32 - if ( !is_dir(base_dir) ) - mkdir(base_dir, 0700); + free (def_tmp); #endif - strcpy (tmp_dir, base_dir); strcat (tmp_dir, "/dviljkXXXXXX"); if ( mkdtemp(tmp_dir) == NULL ) { Warning ("Could not create temporary directory %s, errno = %d; ignoring include file special", |