forked from enlightenment/efl
on Windows, "C:" is not a directory, but a drive.
SVN revision: 55013
This commit is contained in:
parent
b9c9af539a
commit
883850c5ec
|
@ -431,6 +431,15 @@ _ecore_file_mkpath_if_not_exists(const char *path)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
/* Windows: path like C: or D: etc are valid, but stat() returns an error */
|
||||||
|
#ifdef _WIN32
|
||||||
|
if ((strlen(path) == 2) &&
|
||||||
|
((path[0] >= 'a' && path[0] <= 'z') ||
|
||||||
|
(path[0] >= 'A' && path[0] <= 'Z')) &&
|
||||||
|
(path[1] == ':'))
|
||||||
|
return EINA_TRUE;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (stat(path, &st) < 0)
|
if (stat(path, &st) < 0)
|
||||||
return ecore_file_mkdir(path);
|
return ecore_file_mkdir(path);
|
||||||
else if (!S_ISDIR(st.st_mode))
|
else if (!S_ISDIR(st.st_mode))
|
||||||
|
@ -446,9 +455,9 @@ _ecore_file_mkpath_if_not_exists(const char *path)
|
||||||
* @return EINA_TRUE on success, EINA_FALSE otherwise.
|
* @return EINA_TRUE on success, EINA_FALSE otherwise.
|
||||||
*
|
*
|
||||||
* This function create @p path and all the subdirectories it
|
* This function create @p path and all the subdirectories it
|
||||||
* contains. The separator is '/' so, on Windows, '\' must be replaced
|
* contains. The separator is '/' or '\'. If @p path exists, this
|
||||||
* by '/'. If @p path exists, this function returns EINA_TRUE
|
* function returns EINA_TRUE immediatly. It returns EINA_TRUE on
|
||||||
* immediatly. It returns EINA_TRUE on success, EINA_FALSE otherwise.
|
* success, EINA_FALSE otherwise.
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
ecore_file_mkpath(const char *path)
|
ecore_file_mkpath(const char *path)
|
||||||
|
@ -462,7 +471,7 @@ ecore_file_mkpath(const char *path)
|
||||||
for (i = 0; path[i] != '\0'; ss[i] = path[i], i++)
|
for (i = 0; path[i] != '\0'; ss[i] = path[i], i++)
|
||||||
{
|
{
|
||||||
if (i == sizeof(ss) - 1) return EINA_FALSE;
|
if (i == sizeof(ss) - 1) return EINA_FALSE;
|
||||||
if ((path[i] == '/') && (i > 0))
|
if (((path[i] == '/') || (path[i] == '\\')) && (i > 0))
|
||||||
{
|
{
|
||||||
ss[i] = '\0';
|
ss[i] = '\0';
|
||||||
if (!_ecore_file_mkpath_if_not_exists(ss))
|
if (!_ecore_file_mkpath_if_not_exists(ss))
|
||||||
|
|
Loading…
Reference in New Issue