Fixing stuff
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#include <siaapi.h>
|
#include <siaapi.h>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
#include <filepath.h>
|
||||||
|
|
||||||
using namespace Sia::Api;
|
using namespace Sia::Api;
|
||||||
|
|
||||||
@@ -72,43 +73,20 @@ std::vector<SString> CSiaApi::_CSiaFileTree::QueryDirectories(SString rootFolder
|
|||||||
{
|
{
|
||||||
auto fileList = GetFileList();
|
auto fileList = GetFileList();
|
||||||
CSiaFileCollection col;
|
CSiaFileCollection col;
|
||||||
rootFolder.Replace("/", "\\");
|
rootFolder.Replace("/", "\\");
|
||||||
if (rootFolder[0] == '\\')
|
|
||||||
{
|
|
||||||
rootFolder = rootFolder.SubString(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<SString> ret;
|
std::vector<SString> ret;
|
||||||
std::for_each(fileList->begin(), fileList->end(), [&](const CSiaFilePtr& v)
|
std::for_each(fileList->begin(), fileList->end(), [&](const CSiaFilePtr& v)
|
||||||
{
|
{
|
||||||
SString dir = v->GetSiaPath();
|
SString path = ("\\" + FilePath(v->GetSiaPath()).RemoveFileName()).Replace("/", "\\");
|
||||||
dir.Replace("/", "\\");
|
if (path.BeginsWith(rootFolder))
|
||||||
::PathRemoveFileSpec(&dir[0]);
|
{
|
||||||
::PathRemoveBackslash(&dir[0]);
|
path = path.SubString(1, rootFolder.Length());
|
||||||
::PathRemoveBackslash(&rootFolder[0]);
|
if (path.Length())
|
||||||
dir = dir.str().c_str();
|
{
|
||||||
rootFolder = rootFolder.str().c_str();
|
|
||||||
if ((dir.Length() > rootFolder.Length()) && (dir.SubString(0, rootFolder.Length()) == rootFolder))
|
|
||||||
{
|
|
||||||
SString subFolder = dir.SubString(rootFolder.Length());
|
|
||||||
int idx = subFolder.str().find('\\');
|
|
||||||
if (idx == 0)
|
|
||||||
{
|
|
||||||
subFolder = subFolder.SubString(1);
|
|
||||||
idx = subFolder.str().find('\\');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx > 0)
|
}
|
||||||
{
|
}
|
||||||
subFolder = subFolder.SubString(0, idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto it = std::find(ret.begin(), ret.end(), subFolder);
|
|
||||||
if (it == ret.end())
|
|
||||||
{
|
|
||||||
ret.push_back(subFolder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return std::move(ret);
|
return std::move(ret);
|
||||||
|
@@ -482,12 +482,13 @@ private:
|
|||||||
{
|
{
|
||||||
SString siaFileQuery = CSiaApi::FormatToSiaPath(fileName);
|
SString siaFileQuery = CSiaApi::FormatToSiaPath(fileName);
|
||||||
SString siaRootPath = CSiaApi::FormatToSiaPath(fileName);
|
SString siaRootPath = CSiaApi::FormatToSiaPath(fileName);
|
||||||
FilePath siaDirQuery = siaFileQuery;
|
SString siaDirQuery;
|
||||||
FilePath findFile = GetCacheLocation();
|
FilePath findFile = GetCacheLocation();
|
||||||
FilePath cachePath = GetCacheLocation();
|
FilePath cachePath = GetCacheLocation();
|
||||||
if (FilePath::DirSep == fileName)
|
if (FilePath::DirSep == fileName)
|
||||||
{
|
{
|
||||||
siaFileQuery += L"/*.*";
|
siaFileQuery += L"/*.*";
|
||||||
|
siaDirQuery = "/";
|
||||||
findFile.Append("*");
|
findFile.Append("*");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -497,12 +498,9 @@ private:
|
|||||||
if (dokanFileInfo->IsDirectory)
|
if (dokanFileInfo->IsDirectory)
|
||||||
{
|
{
|
||||||
siaFileQuery += L"/*.*";
|
siaFileQuery += L"/*.*";
|
||||||
|
siaDirQuery = findFile;
|
||||||
findFile.Append("*");
|
findFile.Append("*");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
siaDirQuery = FilePath();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanFindFiles(cachePath, siaDirQuery, siaFileQuery, findFile, fileName)));
|
CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanFindFiles(cachePath, siaDirQuery, siaFileQuery, findFile, fileName)));
|
||||||
|
Reference in New Issue
Block a user