2016-10-16 01:03:31 +02:00
|
|
|
module dtagfs.app;
|
|
|
|
|
|
|
|
import std.stdio;
|
|
|
|
import std.getopt;
|
|
|
|
import std.array;
|
|
|
|
|
|
|
|
import dfuse.fuse;
|
|
|
|
|
|
|
|
import dtagfs.filesystem;
|
|
|
|
import dtagfs.tagprovider;
|
2016-10-16 02:49:56 +02:00
|
|
|
import dtagfs.dublincore;
|
2016-10-16 01:03:31 +02:00
|
|
|
|
|
|
|
void main(string[] args)
|
|
|
|
{
|
|
|
|
//TODO: Make tag provider(s) configurable
|
|
|
|
|
2016-10-16 01:27:28 +02:00
|
|
|
if(args.length < 3)
|
2016-10-16 01:03:31 +02:00
|
|
|
{
|
|
|
|
stderr.writeln("usage: dtagfs <source> <mount point> [-f] [-o option[,options...]]");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-10-16 01:27:28 +02:00
|
|
|
auto source = args[1];
|
|
|
|
auto mountPoint = args[2];
|
2016-10-16 01:03:31 +02:00
|
|
|
|
2016-10-16 02:49:56 +02:00
|
|
|
TagProvider[] tagProviders = [new DublinCoreTagProvider()];
|
2016-10-16 01:03:31 +02:00
|
|
|
|
|
|
|
string[] mountOptions;
|
|
|
|
bool fork;
|
|
|
|
arraySep = ",";
|
|
|
|
auto options = getopt(
|
2016-10-16 01:27:28 +02:00
|
|
|
args,
|
2016-10-16 01:03:31 +02:00
|
|
|
|
|
|
|
"o", &mountOptions,
|
|
|
|
"f|fork", &fork
|
|
|
|
);
|
|
|
|
|
|
|
|
auto filesystem = mount(source, mountPoint, tagProviders, mountOptions, fork);
|
|
|
|
}
|
|
|
|
|
|
|
|
FileSystem mount(string source, string mountPoint, TagProvider[] tagProviders, string[] options, bool fork)
|
|
|
|
{
|
|
|
|
auto filesystem = new FileSystem(source, tagProviders);
|
|
|
|
|
|
|
|
auto fuse = new Fuse("dtagfs", !fork, false);
|
|
|
|
fuse.mount(filesystem, mountPoint, options);
|
|
|
|
|
|
|
|
return filesystem;
|
|
|
|
}
|
|
|
|
|