diff options
author | doursse <doursse> | 2007-09-21 17:06:24 +0000 |
---|---|---|
committer | doursse <doursse@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33> | 2007-09-21 17:06:24 +0000 |
commit | 251f9a2f62ebc5c9ad835021c3e01a15c4f79a34 (patch) | |
tree | e1e9f7891a03f9c8e778b6329bb806f2a7afc35a /legacy/ecore/src/lib/ecore_file/ecore_file.c | |
parent | b2bc472a1700a591f143e016c8be971e85134290 (diff) |
Windows port: mkdir is obsolete with vc++, use _mkdir instead. Define macros for realpath and mkdir
SVN revision: 31771
Diffstat (limited to '')
-rw-r--r-- | legacy/ecore/src/lib/ecore_file/ecore_file.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/legacy/ecore/src/lib/ecore_file/ecore_file.c b/legacy/ecore/src/lib/ecore_file/ecore_file.c index d9997ce327..920dad9e51 100644 --- a/legacy/ecore/src/lib/ecore_file/ecore_file.c +++ b/legacy/ecore/src/lib/ecore_file/ecore_file.c | |||
@@ -22,9 +22,10 @@ | |||
22 | 22 | ||
23 | static int init = 0; | 23 | static int init = 0; |
24 | 24 | ||
25 | /* FIXME: Windows has no symbolic link. */ | ||
26 | /* Nevertheless, it can creates .lnk files */ | ||
27 | #ifdef _WIN32 | 25 | #ifdef _WIN32 |
26 | |||
27 | /* FIXME: Windows has no symbolic link. */ | ||
28 | /* Nevertheless, it can create and read .lnk files */ | ||
28 | static int | 29 | static int |
29 | symlink(const char *oldpath, const char *newpath) | 30 | symlink(const char *oldpath, const char *newpath) |
30 | { | 31 | { |
@@ -129,6 +130,11 @@ readlink(const char *path, char *buf, size_t bufsiz) | |||
129 | CoUninitialize(); | 130 | CoUninitialize(); |
130 | return -1; | 131 | return -1; |
131 | } | 132 | } |
133 | |||
134 | #define realpath(file_name, resolved_name) _fullpath((resolved_name), (file_name), PATH_MAX) | ||
135 | |||
136 | #define mkdir(path, mode) _mkdir((path)) | ||
137 | |||
132 | #endif /* _WIN32 */ | 138 | #endif /* _WIN32 */ |
133 | 139 | ||
134 | /* externally accessible functions */ | 140 | /* externally accessible functions */ |
@@ -248,11 +254,7 @@ static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S | |||
248 | EAPI int | 254 | EAPI int |
249 | ecore_file_mkdir(const char *dir) | 255 | ecore_file_mkdir(const char *dir) |
250 | { | 256 | { |
251 | #ifndef _WIN32 | ||
252 | if (mkdir(dir, default_mode) < 0) return 0; | 257 | if (mkdir(dir, default_mode) < 0) return 0; |
253 | #else | ||
254 | if (mkdir(dir) < 0) return 0; | ||
255 | #endif /* _WIN32 */ | ||
256 | return 1; | 258 | return 1; |
257 | } | 259 | } |
258 | 260 | ||
@@ -381,13 +383,8 @@ ecore_file_cp(const char *src, const char *dst) | |||
381 | size_t num; | 383 | size_t num; |
382 | int ret = 1; | 384 | int ret = 1; |
383 | 385 | ||
384 | #ifndef _WIN32 | ||
385 | if (!realpath(src, realpath1)) return 0; | 386 | if (!realpath(src, realpath1)) return 0; |
386 | if (realpath(dst, realpath2) && !strcmp(realpath1, realpath2)) return 0; | 387 | if (realpath(dst, realpath2) && !strcmp(realpath1, realpath2)) return 0; |
387 | #else | ||
388 | if (!_fullpath(realpath1, src, _MAX_PATH)) return 0; | ||
389 | if (_fullpath(realpath2, dst, _MAX_PATH) && !strcmp(realpath1, realpath2)) return 0; | ||
390 | #endif /* _WIN32 */ | ||
391 | 388 | ||
392 | f1 = fopen(src, "rb"); | 389 | f1 = fopen(src, "rb"); |
393 | if (!f1) return 0; | 390 | if (!f1) return 0; |
@@ -461,11 +458,7 @@ ecore_file_realpath(const char *file) | |||
461 | { | 458 | { |
462 | char buf[PATH_MAX]; | 459 | char buf[PATH_MAX]; |
463 | 460 | ||
464 | #ifndef _WIN32 | ||
465 | if (!realpath(file, buf)) return strdup(""); | 461 | if (!realpath(file, buf)) return strdup(""); |
466 | #else | ||
467 | if (!_fullpath(buf, file, _MAX_PATH)) return strdup(""); | ||
468 | #endif /* _WIN32 */ | ||
469 | 462 | ||
470 | return strdup(buf); | 463 | return strdup(buf); |
471 | } | 464 | } |