Moved directory creating functions to common.h

Removed duplicate function
This commit is contained in:
James Booth
2013-02-02 22:06:19 +00:00
parent 9d34c41227
commit d86a774953
3 changed files with 21 additions and 32 deletions

View File

@@ -79,6 +79,19 @@ create_dir(char *name)
e = mkdir(name, S_IRWXU);
}
void
mkdir_recursive(const char *dir)
{
int i;
for (i = 1; i <= strlen(dir); i++) {
if (dir[i] == '/' || dir[i] == '\0') {
gchar *next_dir = g_strndup(dir, i);
create_dir(next_dir);
g_free(next_dir);
}
}
}
char *
str_replace(const char *string, const char *substr,
const char *replacement)