1
0

Fixing stuff

This commit is contained in:
Scott E. Graves
2017-04-03 23:19:44 -05:00
parent aabd34b74a
commit 7c1c1b46c4
2 changed files with 15 additions and 39 deletions

View File

@@ -1,5 +1,6 @@
#include <siaapi.h>
#include <regex>
#include <filepath.h>
using namespace Sia::Api;
@@ -72,43 +73,20 @@ std::vector<SString> CSiaApi::_CSiaFileTree::QueryDirectories(SString rootFolder
{
auto fileList = GetFileList();
CSiaFileCollection col;
rootFolder.Replace("/", "\\");
if (rootFolder[0] == '\\')
{
rootFolder = rootFolder.SubString(1);
}
rootFolder.Replace("/", "\\");
std::vector<SString> ret;
std::for_each(fileList->begin(), fileList->end(), [&](const CSiaFilePtr& v)
{
SString dir = v->GetSiaPath();
dir.Replace("/", "\\");
::PathRemoveFileSpec(&dir[0]);
::PathRemoveBackslash(&dir[0]);
::PathRemoveBackslash(&rootFolder[0]);
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);
}
}
SString path = ("\\" + FilePath(v->GetSiaPath()).RemoveFileName()).Replace("/", "\\");
if (path.BeginsWith(rootFolder))
{
path = path.SubString(1, rootFolder.Length());
if (path.Length())
{
}
}
});
return std::move(ret);

View File

@@ -482,12 +482,13 @@ private:
{
SString siaFileQuery = CSiaApi::FormatToSiaPath(fileName);
SString siaRootPath = CSiaApi::FormatToSiaPath(fileName);
FilePath siaDirQuery = siaFileQuery;
SString siaDirQuery;
FilePath findFile = GetCacheLocation();
FilePath cachePath = GetCacheLocation();
if (FilePath::DirSep == fileName)
{
siaFileQuery += L"/*.*";
siaFileQuery += L"/*.*";
siaDirQuery = "/";
findFile.Append("*");
}
else
@@ -497,12 +498,9 @@ private:
if (dokanFileInfo->IsDirectory)
{
siaFileQuery += L"/*.*";
siaDirQuery = findFile;
findFile.Append("*");
}
else
{
siaDirQuery = FilePath();
}
}
CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DokanFindFiles(cachePath, siaDirQuery, siaFileQuery, findFile, fileName)));