diff --git a/src/api/webDAV.cpp b/src/api/webDAV.cpp index ca77a11..e7e05b3 100644 --- a/src/api/webDAV.cpp +++ b/src/api/webDAV.cpp @@ -167,11 +167,6 @@ vector 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()); diff --git a/src/handler/eventHandler.cpp b/src/handler/eventHandler.cpp index cf9168c..f737ece 100644 --- a/src/handler/eventHandler.cpp +++ b/src/handler/eventHandler.cpp @@ -678,20 +678,26 @@ void EventHandler::updateItems(vector &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; - else + 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; + items.at(0).state = FileState::ISYNCED; _sqllite.saveItemsChildren(items); //TODO sync delete when not parentPath existend --> "select * from metadata where parentPath NOT IN (Select