summaryrefslogtreecommitdiff
path: root/mg_tools.c
diff options
context:
space:
mode:
Diffstat (limited to 'mg_tools.c')
-rw-r--r--mg_tools.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/mg_tools.c b/mg_tools.c
index a6f6323..ce09ab6 100644
--- a/mg_tools.c
+++ b/mg_tools.c
@@ -126,3 +126,24 @@ std::string trim(std::string const& source, char const* delims ) {
result.erase();
return result;
}
+
+
+char *
+SeparateFolders(const char *filename, char * folders[],unsigned int fcount)
+{
+ for (unsigned int i=0;i<fcount;i++)
+ folders[i]="";
+ char *fbuf=strdup(filename);
+ char *slash=fbuf-1;
+ for (unsigned int i=0;i<fcount;i++)
+ {
+ char *p=slash+1;
+ slash=strchr(p,'/');
+ if (!slash)
+ break;
+ folders[i]=p;
+ *slash=0;
+ }
+ return fbuf;
+}
+