forked from enlightenment/efl
update win32 port : use correct temp dir value and correct open function according to the compiler
SVN revision: 32882
This commit is contained in:
parent
4317fe9155
commit
5b257881d7
|
@ -3,7 +3,8 @@
|
|||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <windows.h>
|
||||
# include <share.h>
|
||||
# include <sys/stat.h>
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
|
@ -590,24 +591,32 @@ data_write(void)
|
|||
cd = l->data;
|
||||
if ((cd->shared) || (cd->programs))
|
||||
{
|
||||
char tmpn[4096];
|
||||
int fd;
|
||||
#ifdef _WIN32
|
||||
int ret;
|
||||
char path[4096];
|
||||
char *tmpdir;
|
||||
#endif /* _WIN32 */
|
||||
char tmpn[4096];
|
||||
|
||||
#ifdef _WIN32
|
||||
ret = GetTempPath(_MAX_PATH, path);
|
||||
if ((ret > _MAX_PATH) || (ret == 0))
|
||||
fd = -1;
|
||||
else
|
||||
tmpdir = getenv("TMP");
|
||||
if (!tmpdir) tmpdir = getenv("TEMP");
|
||||
if (!tmpdir) tmpdir = getenv("USERPROFILE");
|
||||
if (!tmpdir) tmpdir = getenv("WINDIR");
|
||||
if (tmpdir)
|
||||
{
|
||||
if (!GetTempFileName(path, "edj", 0, tmpn))
|
||||
fd = -1;
|
||||
snprintf(tmpn, _MAX_PATH, "%s/edje_cc.sma-tmp-XXXXXX", tmpdir);
|
||||
# ifdef __MINGW32__
|
||||
if (_mktemp(tmpn))
|
||||
fd = _sopen(tmpn, _O_RDWR | _O_BINARY | _O_CREAT, _SH_DENYNO, _S_IREAD | _S_IWRITE);
|
||||
# else
|
||||
if (!_mktemp_s(tmpn, _MAX_PATH))
|
||||
_sopen_s(&fd, tmpn, _O_RDWR | _O_BINARY | _O_CREAT, _SH_DENYNO, _S_IREAD | _S_IWRITE);
|
||||
# endif /* __MINGW32__ */
|
||||
else
|
||||
fd = open(tmpn, _O_RDWR | _O_BINARY | _O_CREAT, 0444);
|
||||
fd = -1;
|
||||
}
|
||||
else
|
||||
fd= -1;
|
||||
#else
|
||||
strcpy(tmpn, "/tmp/edje_cc.sma-tmp-XXXXXX");
|
||||
fd = mkstemp(tmpn);
|
||||
|
@ -693,16 +702,25 @@ data_write(void)
|
|||
}
|
||||
close(fd);
|
||||
#ifdef _WIN32
|
||||
ret = GetTempPath(_MAX_PATH, path);
|
||||
if ((ret > _MAX_PATH) || (ret == 0))
|
||||
fd = -1;
|
||||
else
|
||||
tmpdir = getenv("TMP");
|
||||
if (!tmpdir) tmpdir = getenv("TEMP");
|
||||
if (!tmpdir) tmpdir = getenv("USERPROFILE");
|
||||
if (!tmpdir) tmpdir = getenv("WINDIR");
|
||||
if (tmpdir)
|
||||
{
|
||||
if (!GetTempFileName(path, "edj", 0, tmpo))
|
||||
fd = -1;
|
||||
snprintf(tmpo, _MAX_PATH, "%s/edje_cc.amx-tmp-XXXXXX", tmpdir);
|
||||
# ifdef __MINGW32__
|
||||
if (_mktemp(tmpo))
|
||||
fd = _sopen(tmpo, _O_RDWR | _O_BINARY | _O_CREAT, _SH_DENYNO, _S_IREAD | _S_IWRITE);
|
||||
# else
|
||||
if (!_mktemp_s(tmpo, _MAX_PATH))
|
||||
_sopen_s(&fd, tmpo, _O_RDWR | _O_BINARY | _O_CREAT, _SH_DENYNO, _S_IREAD | _S_IWRITE);
|
||||
# endif /* __MINGW32__ */
|
||||
else
|
||||
fd = open(tmpo, _O_RDWR | _O_BINARY | _O_CREAT, 0444);
|
||||
fd = -1;
|
||||
}
|
||||
else
|
||||
fd= -1;
|
||||
#else
|
||||
strcpy(tmpo, "/tmp/edje_cc.amx-tmp-XXXXXX");
|
||||
fd = mkstemp(tmpo);
|
||||
|
|
|
@ -163,10 +163,10 @@ source_fetch_file(const char *fil, const char *filname)
|
|||
*slash = '\0';
|
||||
dir_len = strlen(dir);
|
||||
}
|
||||
|
||||
|
||||
l = pp - p + dir_len + 1;
|
||||
file = mem_alloc(l);
|
||||
|
||||
|
||||
if (!dir_len)
|
||||
snprintf(file, l - 1, "%s", p + 1);
|
||||
else
|
||||
|
@ -174,7 +174,7 @@ source_fetch_file(const char *fil, const char *filname)
|
|||
|
||||
fname = strdup(p + 1);
|
||||
pp = strrchr(fname, end);
|
||||
if (pp) *pp = 0;
|
||||
if (pp) *pp = '\0';
|
||||
forgetit = 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue