Compare commits
No commits in common. "master" and "v0.1.3" have entirely different histories.
|
@ -193,7 +193,7 @@ extern(System)
|
|||
threads from the runtime because after fuse_main finishes the pthreads
|
||||
are joined. We circumvent that problem by just exiting while our
|
||||
threads still run. */
|
||||
import core.stdc.stdlib : exit;
|
||||
import std.c.process;
|
||||
exit(0);
|
||||
}
|
||||
} /* extern(C) */
|
||||
|
|
|
@ -115,15 +115,6 @@ class FileSystem : Operations
|
|||
return _fileLinkCache[name];
|
||||
}
|
||||
|
||||
Tuple!(bool, "exclude", string, "name")[] pathToTagTuples(const(char)[] path)
|
||||
{
|
||||
//map the path to a range of tuples with an exclude (bool) and a name (string) field for each tag in the path
|
||||
return pathSplitter(path)
|
||||
.array[1..$]
|
||||
.map!(tag => tuple!("exclude", "name")(tag[0] == exclusionChar, cast(immutable)tag.stripLeft(exclusionChar)))
|
||||
.array;
|
||||
}
|
||||
|
||||
string[] getTags(const(char)[] path)
|
||||
{
|
||||
if(path == "/")
|
||||
|
@ -132,13 +123,12 @@ class FileSystem : Operations
|
|||
}
|
||||
else
|
||||
{
|
||||
auto tags = pathToTagTuples(path);
|
||||
auto tags = pathSplitter(path).array[1..$];
|
||||
|
||||
//filter pairs with tags that (should not be excluded && can be found) || (should be excluded && can't be found)
|
||||
auto filePairs = _tagCache.byKeyValue().filter!(a => tags.all!(b => !b.exclude == a.value.canFind(b.name)));
|
||||
auto filePairs = _tagCache.byKeyValue().filter!(a => tags.all!(b => a.value.canFind(b)));
|
||||
return filePairs.map!(a => a.value)
|
||||
.joiner
|
||||
.filter!(a => !tags.map!(tag => tag.name).canFind(a)) //don't match tags that are already in the path
|
||||
.filter!(a => !tags.canFind(a))
|
||||
.filter!(a => !_noCommon || !filePairs.all!(f => f.value.canFind(a)))
|
||||
.array
|
||||
.sort()
|
||||
|
@ -155,7 +145,10 @@ class FileSystem : Operations
|
|||
}
|
||||
else
|
||||
{
|
||||
auto tags = pathToTagTuples(path);
|
||||
//map the path to a range of tuples with an exclude (bool) and a name (string) field for each tag in the path
|
||||
auto tags = pathSplitter(path)
|
||||
.array[1..$]
|
||||
.map!(tag => tuple!("exclude", "name")(tag[0] == exclusionChar, tag.stripLeft(exclusionChar)));
|
||||
|
||||
//filter files with tags that (should not be excluded && can be found) || (should be excluded && can't be found)
|
||||
return _tagCache.byKeyValue()
|
||||
|
|
Loading…
Reference in New Issue