Fix status for local items
parent
4ea9873ddc
commit
c24199420e
|
@ -167,11 +167,6 @@ vector<WebDAVItem> WebDAV::getDataStructure(const string &pathUrl)
|
||||||
{
|
{
|
||||||
tempItem.type = Itemtype::IFILE;
|
tempItem.type = Itemtype::IFILE;
|
||||||
tempItem.fileType = Util::getXMLAttribute(xmlItem, "d:getcontenttype");
|
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());
|
tempItem.title = tempItem.title.substr(tempItem.title.find_last_of("/") + 1, tempItem.title.length());
|
||||||
|
|
|
@ -678,20 +678,26 @@ void EventHandler::updateItems(vector<WebDAVItem> &items)
|
||||||
{
|
{
|
||||||
item.state = _sqllite.getState(item.path);
|
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::ISYNCED;
|
||||||
item.state = FileState::ICLOUD;
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if(item.type == Itemtype::IFOLDER)
|
||||||
|
{
|
||||||
iv_mkdir(item.localPath.c_str(), 0777);
|
iv_mkdir(item.localPath.c_str(), 0777);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item.state = FileState::ICLOUD;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_sqllite.getEtag(item.path).compare(item.etag) != 0)
|
if (_sqllite.getEtag(item.path).compare(item.etag) != 0)
|
||||||
{
|
|
||||||
item.state = (item.state == FileState::ISYNCED) ? FileState::IOUTSYNCED : FileState::ICLOUD;
|
item.state = (item.state == FileState::ISYNCED) ? FileState::IOUTSYNCED : FileState::ICLOUD;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
items.at(0).state =FileState::ISYNCED;
|
items.at(0).state = FileState::ISYNCED;
|
||||||
_sqllite.saveItemsChildren(items);
|
_sqllite.saveItemsChildren(items);
|
||||||
|
|
||||||
//TODO sync delete when not parentPath existend --> "select * from metadata where parentPath NOT IN (Select
|
//TODO sync delete when not parentPath existend --> "select * from metadata where parentPath NOT IN (Select
|
||||||
|
|
Loading…
Reference in New Issue