Browse Source

source mount paths can contain globing. closes #10

pull/36/head
Antonio SJ Musumeci 11 years ago
parent
commit
645c823778
  1. 32
      src/option_parser.cpp

32
src/option_parser.cpp

@ -26,14 +26,19 @@
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <glob.h>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include "config.hpp"
#include "policy.hpp"
using std::string;
using std::vector;
using namespace mergerfs;
template<typename Container>
@ -89,6 +94,29 @@ process_opt(config::Config &config,
return rv;
}
static
void
process_srcmounts(const char *arg,
config::Config &config)
{
int flags;
glob_t gbuf;
vector<string> paths;
flags = 0;
split(paths,arg,':');
for(size_t i = 0; i < paths.size(); i++)
{
glob(paths[i].c_str(),flags,NULL,&gbuf);
flags = GLOB_APPEND;
}
for(size_t i = 0; i < gbuf.gl_pathc; ++i)
config.srcmounts.push_back(gbuf.gl_pathv[i]);
globfree(&gbuf);
}
static
int
option_processor(void *data,
@ -113,7 +141,7 @@ option_processor(void *data,
}
else
{
split(config.srcmounts,arg,':');
process_srcmounts(arg,config);
}
break;

Loading…
Cancel
Save