summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore_file/ecore_file.c
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2010-11-26 13:47:51 +0000
committerVincent Torri <vincent.torri@gmail.com>2010-11-26 13:47:51 +0000
commit883850c5ecbb05ae9193b9a9aeba8f90962e4dd7 (patch)
tree790733258881dac2149db7787e956abc6d22ab64 /legacy/ecore/src/lib/ecore_file/ecore_file.c
parentb9c9af539ab1a228682137925e6ed9637844c703 (diff)
on Windows, "C:" is not a directory, but a drive.
SVN revision: 55013
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore_file/ecore_file.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/legacy/ecore/src/lib/ecore_file/ecore_file.c b/legacy/ecore/src/lib/ecore_file/ecore_file.c
index b568ca2d6e..acd24e201b 100644
--- a/legacy/ecore/src/lib/ecore_file/ecore_file.c
+++ b/legacy/ecore/src/lib/ecore_file/ecore_file.c
@@ -431,6 +431,15 @@ _ecore_file_mkpath_if_not_exists(const char *path)
431{ 431{
432 struct stat st; 432 struct stat st;
433 433
434 /* Windows: path like C: or D: etc are valid, but stat() returns an error */
435#ifdef _WIN32
436 if ((strlen(path) == 2) &&
437 ((path[0] >= 'a' && path[0] <= 'z') ||
438 (path[0] >= 'A' && path[0] <= 'Z')) &&
439 (path[1] == ':'))
440 return EINA_TRUE;
441#endif
442
434 if (stat(path, &st) < 0) 443 if (stat(path, &st) < 0)
435 return ecore_file_mkdir(path); 444 return ecore_file_mkdir(path);
436 else if (!S_ISDIR(st.st_mode)) 445 else if (!S_ISDIR(st.st_mode))
@@ -446,9 +455,9 @@ _ecore_file_mkpath_if_not_exists(const char *path)
446 * @return EINA_TRUE on success, EINA_FALSE otherwise. 455 * @return EINA_TRUE on success, EINA_FALSE otherwise.
447 * 456 *
448 * This function create @p path and all the subdirectories it 457 * This function create @p path and all the subdirectories it
449 * contains. The separator is '/' so, on Windows, '\' must be replaced 458 * contains. The separator is '/' or '\'. If @p path exists, this
450 * by '/'. If @p path exists, this function returns EINA_TRUE 459 * function returns EINA_TRUE immediatly. It returns EINA_TRUE on
451 * immediatly. It returns EINA_TRUE on success, EINA_FALSE otherwise. 460 * success, EINA_FALSE otherwise.
452 */ 461 */
453EAPI Eina_Bool 462EAPI Eina_Bool
454ecore_file_mkpath(const char *path) 463ecore_file_mkpath(const char *path)
@@ -462,7 +471,7 @@ ecore_file_mkpath(const char *path)
462 for (i = 0; path[i] != '\0'; ss[i] = path[i], i++) 471 for (i = 0; path[i] != '\0'; ss[i] = path[i], i++)
463 { 472 {
464 if (i == sizeof(ss) - 1) return EINA_FALSE; 473 if (i == sizeof(ss) - 1) return EINA_FALSE;
465 if ((path[i] == '/') && (i > 0)) 474 if (((path[i] == '/') || (path[i] == '\\')) && (i > 0))
466 { 475 {
467 ss[i] = '\0'; 476 ss[i] = '\0';
468 if (!_ecore_file_mkpath_if_not_exists(ss)) 477 if (!_ecore_file_mkpath_if_not_exists(ss))