also check local directories and delete them

pull/23/head
JuanJakobo 2021-02-22 16:54:28 +01:00
parent 89302c85d2
commit 88fafc108f
1 changed files with 18 additions and 8 deletions

View File

@ -207,6 +207,14 @@ void Nextcloud::downloadItem(vector<Item> &tempItems, int itemID)
void Nextcloud::downloadFolder(vector<Item> &tempItems, int itemID)
{
BanSleep(2000);
if (tempItems.at(itemID).getState() == FileState::ILOCAL)
{
UpdateProgressbar(("Removing local item " + tempItems.at(itemID).getLocalPath()).c_str(), 0);
tempItems.at(itemID).removeFile();
return;
}
if (tempItems.at(itemID).getType() == Itemtype::IFOLDER)
{
string temp = tempItems.at(itemID).getPath();
@ -490,21 +498,23 @@ void Nextcloud::getLocalFileStructure(vector<Item> &tempItems, const string &loc
continue;
const bool isDirectory = (st.st_mode & S_IFDIR) != 0;
if (isDirectory)
continue;
bool found = false;
for (auto i = 0; i < tempItems.size(); i++)
for (auto i = 1; i < tempItems.size(); i++)
{
if (tempItems.at(i).getLocalPath().compare(fullFileName) == 0)
{
if (!isDirectory)
{
std::ifstream in(fullFileName, std::ifstream::binary | std::ifstream::ate);
Log::writeLog(tempItems.at(i).getTitle());
Log::writeLog(Util::valueToString(in.tellg()));
Log::writeLog(Util::valueToString(tempItems.at(i).getSize()));
if (in.tellg() != tempItems.at(i).getSize())
{
tempItems.at(i).setState(FileState::IOUTSYNCED);
}
}
found = true;
break;
}