forked from enlightenment/efl
Remove wasted whitespace & fix some formatting.
SVN revision: 44861
This commit is contained in:
parent
36e6b34070
commit
741a725889
|
@ -178,7 +178,9 @@ EAPI int
|
||||||
ecore_file_mkdirs(const char **dirs)
|
ecore_file_mkdirs(const char **dirs)
|
||||||
{
|
{
|
||||||
if (!dirs) return -1;
|
if (!dirs) return -1;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (; *dirs != NULL; dirs++)
|
for (; *dirs != NULL; dirs++)
|
||||||
if (ecore_file_mkdir(*dirs))
|
if (ecore_file_mkdir(*dirs))
|
||||||
i++;
|
i++;
|
||||||
|
@ -323,17 +325,14 @@ ecore_file_remove(const char *file)
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_file_recursive_rm(const char *dir)
|
ecore_file_recursive_rm(const char *dir)
|
||||||
{
|
{
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX], buf[PATH_MAX];
|
||||||
char buf[PATH_MAX];
|
struct stat st;
|
||||||
struct stat st;
|
int ret;
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (readlink(dir, buf, sizeof(buf)) > 0)
|
if (readlink(dir, buf, sizeof(buf)) > 0)
|
||||||
{
|
return ecore_file_unlink(dir);
|
||||||
return ecore_file_unlink(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = stat(dir, &st);
|
ret = stat(dir, &st);
|
||||||
if ((ret == 0) && (S_ISDIR(st.st_mode)))
|
if ((ret == 0) && (S_ISDIR(st.st_mode)))
|
||||||
|
@ -370,6 +369,7 @@ static inline int
|
||||||
_ecore_file_mkpath_if_not_exists(const char *path)
|
_ecore_file_mkpath_if_not_exists(const char *path)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
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))
|
||||||
|
@ -419,8 +419,11 @@ ecore_file_mkpath(const char *path)
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_file_mkpaths(const char **paths)
|
ecore_file_mkpaths(const char **paths)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!paths) return -1;
|
if (!paths) return -1;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (; *paths != NULL; paths++)
|
for (; *paths != NULL; paths++)
|
||||||
if (ecore_file_mkpath(*paths))
|
if (ecore_file_mkpath(*paths))
|
||||||
i++;
|
i++;
|
||||||
|
@ -436,12 +439,11 @@ ecore_file_mkpaths(const char **paths)
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_file_cp(const char *src, const char *dst)
|
ecore_file_cp(const char *src, const char *dst)
|
||||||
{
|
{
|
||||||
FILE *f1, *f2;
|
FILE *f1, *f2;
|
||||||
char buf[16384];
|
char buf[16384];
|
||||||
char realpath1[PATH_MAX];
|
char realpath1[PATH_MAX], realpath2[PATH_MAX];
|
||||||
char realpath2[PATH_MAX];
|
size_t num;
|
||||||
size_t num;
|
int ret = 1;
|
||||||
int ret = 1;
|
|
||||||
|
|
||||||
if (!realpath(src, realpath1)) return 0;
|
if (!realpath(src, realpath1)) return 0;
|
||||||
if (realpath(dst, realpath2) && !strcmp(realpath1, realpath2)) return 0;
|
if (realpath(dst, realpath2) && !strcmp(realpath1, realpath2)) return 0;
|
||||||
|
@ -489,6 +491,7 @@ ecore_file_mv(const char *src, const char *dst)
|
||||||
if (S_ISREG(st.st_mode))
|
if (S_ISREG(st.st_mode))
|
||||||
{
|
{
|
||||||
char *dir;
|
char *dir;
|
||||||
|
|
||||||
dir = ecore_file_dir_get(dst);
|
dir = ecore_file_dir_get(dst);
|
||||||
// Since we can't directly rename, try to
|
// Since we can't directly rename, try to
|
||||||
// copy to temp file in the dst directory
|
// copy to temp file in the dst directory
|
||||||
|
@ -559,7 +562,7 @@ ecore_file_symlink(const char *src, const char *dest)
|
||||||
EAPI char *
|
EAPI char *
|
||||||
ecore_file_realpath(const char *file)
|
ecore_file_realpath(const char *file)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some implementations of realpath do not conform to the SUS.
|
* Some implementations of realpath do not conform to the SUS.
|
||||||
|
@ -595,15 +598,12 @@ ecore_file_file_get(const char *path)
|
||||||
EAPI char *
|
EAPI char *
|
||||||
ecore_file_dir_get(const char *file)
|
ecore_file_dir_get(const char *file)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
strncpy(buf, file, PATH_MAX);
|
strncpy(buf, file, PATH_MAX);
|
||||||
p = strrchr(buf, '/');
|
p = strrchr(buf, '/');
|
||||||
if (!p)
|
if (!p) return strdup(file);
|
||||||
{
|
|
||||||
return strdup(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p == buf) return strdup("/");
|
if (p == buf) return strdup("/");
|
||||||
|
|
||||||
|
@ -658,8 +658,8 @@ ecore_file_can_exec(const char *file)
|
||||||
EAPI char *
|
EAPI char *
|
||||||
ecore_file_readlink(const char *link)
|
ecore_file_readlink(const char *link)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
if ((count = readlink(link, buf, sizeof(buf))) < 0) return NULL;
|
if ((count = readlink(link, buf, sizeof(buf))) < 0) return NULL;
|
||||||
buf[count] = 0;
|
buf[count] = 0;
|
||||||
|
@ -679,10 +679,10 @@ ecore_file_readlink(const char *link)
|
||||||
EAPI Eina_List *
|
EAPI Eina_List *
|
||||||
ecore_file_ls(const char *dir)
|
ecore_file_ls(const char *dir)
|
||||||
{
|
{
|
||||||
char *f;
|
char *f;
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
Eina_List *list = NULL;
|
Eina_List *list = NULL;
|
||||||
|
|
||||||
dirp = opendir(dir);
|
dirp = opendir(dir);
|
||||||
if (!dirp) return NULL;
|
if (!dirp) return NULL;
|
||||||
|
@ -902,9 +902,7 @@ ecore_file_strip_ext(const char *path)
|
||||||
|
|
||||||
p = strrchr(path, '.');
|
p = strrchr(path, '.');
|
||||||
if (!p)
|
if (!p)
|
||||||
{
|
file = strdup(path);
|
||||||
file = strdup(path);
|
|
||||||
}
|
|
||||||
else if (p != path)
|
else if (p != path)
|
||||||
{
|
{
|
||||||
file = malloc(((p - path) + 1) * sizeof(char));
|
file = malloc(((p - path) + 1) * sizeof(char));
|
||||||
|
|
Loading…
Reference in New Issue