Skip to content

Commit

Permalink
Adapt changes from fileBrowser to local method
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanJakobo committed Jul 29, 2022
1 parent 0b54a2c commit 7fd2d3c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/handler/eventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,23 +511,23 @@ void EventHandler::getLocalFileStructure(vector<WebDAVItem> &items)
class stat st;

string localPath = items.at(0).localPath + '/';
if(localPath.back() != '/')
localPath = localPath + '/';
if (iv_access(localPath.c_str(), W_OK) == 0)
{

dir = opendir(localPath.c_str());
Log::writeInfoLog("localPath = " + localPath);
while ((ent = readdir(dir)) != NULL)
{
const string fileName = ent->d_name;
const string fullFileName = localPath + fileName;

if (fileName[0] == '.')
continue;

const string fullFileName = localPath + fileName;

if (stat(fullFileName.c_str(), &st) == -1)
continue;

const bool isDirectory = (st.st_mode & S_IFDIR) != 0;

bool found = false;
for (unsigned int i = 1; i < items.size(); i++)
Expand All @@ -545,7 +545,7 @@ void EventHandler::getLocalFileStructure(vector<WebDAVItem> &items)
temp.state = FileState::ILOCAL;
temp.title = fullFileName.substr(fullFileName.find_last_of("/") + 1, fullFileName.length());
Util::decodeUrl(temp.title);
if (isDirectory)
if ((st.st_mode & S_IFDIR) != 0)
{
//create new dir in cloud
temp.type = Itemtype::IFOLDER;
Expand Down

0 comments on commit 7fd2d3c

Please sign in to comment.