Fix status for local items

master
JuanJakobo 2022-08-06 12:56:16 +02:00
parent 4ea9873ddc
commit c24199420e
2 changed files with 13 additions and 12 deletions

View File

@ -167,11 +167,6 @@ vector<WebDAVItem> WebDAV::getDataStructure(const string &pathUrl)
{
tempItem.type = Itemtype::IFILE;
tempItem.fileType = Util::getXMLAttribute(xmlItem, "d:getcontenttype");
if (iv_access(tempItem.localPath.c_str(), W_OK) != 0)
tempItem.state = FileState::ICLOUD;
else
tempItem.state = FileState::ISYNCED;
}
tempItem.title = tempItem.title.substr(tempItem.title.find_last_of("/") + 1, tempItem.title.length());

View File

@ -678,19 +678,25 @@ void EventHandler::updateItems(vector<WebDAVItem> &items)
{
item.state = _sqllite.getState(item.path);
if (iv_access(item.localPath.c_str(), W_OK) != 0)
if (iv_access(item.localPath.c_str(), W_OK) == 0)
{
if (item.type == Itemtype::IFILE)
item.state = FileState::ICLOUD;
item.state = FileState::ISYNCED;
}
else
{
if(item.type == Itemtype::IFOLDER)
{
iv_mkdir(item.localPath.c_str(), 0777);
}
else
{
item.state = FileState::ICLOUD;
}
}
if (_sqllite.getEtag(item.path).compare(item.etag) != 0)
{
item.state = (item.state == FileState::ISYNCED) ? FileState::IOUTSYNCED : FileState::ICLOUD;
}
}
items.at(0).state = FileState::ISYNCED;
_sqllite.saveItemsChildren(items);