create localPath variable also for folders
parent
7aaf79e2e7
commit
440fbefa43
|
@ -26,22 +26,21 @@ Item::Item(const string &xmlItem)
|
|||
|
||||
_lastEditDate = Util::getXMLAttribute(xmlItem, "d:getlastmodified");
|
||||
_title = _path;
|
||||
_localPath = Nextcloud::getLocalPath(_path);
|
||||
|
||||
if (_path.back() == '/')
|
||||
{
|
||||
_type = IFOLDER;
|
||||
_localPath = _localPath.substr(0, _localPath.length() - 1);
|
||||
_type = Itemtype::IFOLDER;
|
||||
_title = _title.substr(0, _path.length() - 1);
|
||||
_size = atof(Util::getXMLAttribute(xmlItem, "d:quota-used-bytes").c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
_type = IFILE;
|
||||
_type = Itemtype::IFILE;
|
||||
_size = atof(Util::getXMLAttribute(xmlItem, "d:getcontentlength").c_str());
|
||||
_fileType = Util::getXMLAttribute(xmlItem, "d:getcontenttype");
|
||||
|
||||
//set local path and test if exists
|
||||
_localPath = Nextcloud::getLocalPath(_path);
|
||||
|
||||
if (iv_access(_localPath.c_str(), W_OK) != 0)
|
||||
{
|
||||
_state = FileState::ICLOUD;
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
* @param localPath path where the file is placed
|
||||
* @param FileState state of the file
|
||||
*/
|
||||
Item(const string &localPath, FileState state);
|
||||
Item(const string &localPath, FileState state, Itemtype type);
|
||||
|
||||
/**
|
||||
* Tries to open the item by checking the file format and then executes the fitting action
|
||||
|
|
|
@ -511,8 +511,14 @@ void Nextcloud::getLocalFileStructure(vector<Item> &tempItems, const string &loc
|
|||
}
|
||||
if (!found)
|
||||
{
|
||||
//TODO push to different items list and then ask if shall be deleted later on? --> just in case of folder sync
|
||||
tempItems.push_back(Item(fullFileName, FileState::ILOCAL));
|
||||
if (isDirectory)
|
||||
{
|
||||
tempItems.push_back(Item(fullFileName, FileState::ILOCAL, Itemtype::IFOLDER));
|
||||
}
|
||||
else
|
||||
{
|
||||
tempItems.push_back(Item(fullFileName, FileState::ILOCAL, Itemtype::IFILE));
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
|
|
Loading…
Reference in New Issue