support.cpp (bed-3.0.3.src.tar.xz) | : | support.cpp (bed-3.1.0.src.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 76 | skipping to change at line 76 | |||
#endif | #endif | |||
const int tmpdirnr=(sizeof(tmpdirs)/sizeof(char*)); | const int tmpdirnr=(sizeof(tmpdirs)/sizeof(char*)); | |||
int tmpdirlens[tmpdirnr]={}; | int tmpdirlens[tmpdirnr]={}; | |||
#include "myalloc.h" | #include "myalloc.h" | |||
int namedir(char *buf,int i,const char *name) { | int namedir(char *buf,int i,const char *name) { | |||
const char *tmp=tmpdirs[i]; | const char *tmp=tmpdirs[i]; | |||
if(tmp) { | if(tmp) { | |||
int len; | int len; | |||
if(tmp[0]!='/'|| (!tmpdirlens[i]&& !(tmpdirlens[i]=strlen(tmp)))) { | if(tmp[0]!='/'|| (!tmpdirlens[i]&& !(tmpdirlens[i]=strlen(tmp)))) { | |||
#ifdef _WIN32 | //#ifdef _WIN32 | |||
#ifdef __CYGWIN__ | ||||
absunixpath(tmp,buf); | absunixpath(tmp,buf); | |||
#else | #else | |||
#ifdef HAS_REALPATH | #ifdef HAS_REALPATH | |||
if(!realpath(tmp,buf)) | if(!realpath(tmp,buf)) | |||
return 0; | return 0; | |||
#else | #else | |||
expandfilename(buf,tmp); | expandfilename(buf,tmp); | |||
#endif | #endif | |||
#endif | #endif | |||
len=strlen(buf); | len=strlen(buf); | |||
skipping to change at line 111 | skipping to change at line 112 | |||
else | else | |||
return 0; | return 0; | |||
} | } | |||
int mytmpname(char *buf,int len,const char *name) { | int mytmpname(char *buf,int len,const char *name) { | |||
for(int i=0;i<tmpdirnr;i++) { | for(int i=0;i<tmpdirnr;i++) { | |||
if(int ret=namedir(buf, i,name) ) { | if(int ret=namedir(buf, i,name) ) { | |||
if(mktemp(buf)&&writable(buf)) | if(mktemp(buf)&&writable(buf)) | |||
return ret; | return ret; | |||
} | } | |||
} | } | |||
#ifdef _WIN32 | //#ifdef _WIN32 | |||
#ifdef __CYGWIN__ | ||||
char tmp[len]; | char tmp[len]; | |||
if(DWORD plen= GetTempPath(len,tmp)) { | if(DWORD plen= GetTempPath(len,tmp)) { | |||
strcpy(tmp+plen,name); | strcpy(tmp+plen,name); | |||
absunixpath(tmp,buf); | absunixpath(tmp,buf); | |||
if(mktemp(buf)&&writable(buf)) | if(mktemp(buf)&&writable(buf)) | |||
return plen; | return plen; | |||
} | } | |||
#endif | #endif | |||
strcpy(buf,name); | strcpy(buf,name); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 4 lines changed or added |