Fixing stuff
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user