Use C++17 method Filesystem instead of local
parent
27fce30665
commit
2042ca4da5
|
@ -81,7 +81,7 @@ include_directories(
|
||||||
${CMAKE_SOURCE_DIR}/src/api/
|
${CMAKE_SOURCE_DIR}/src/api/
|
||||||
)
|
)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES (Nextcloud.app PRIVATE inkview freetype curl sqlite3)
|
TARGET_LINK_LIBRARIES (Nextcloud.app PRIVATE inkview freetype curl sqlite3 stdc++fs)
|
||||||
|
|
||||||
INSTALL (TARGETS Nextcloud.app)
|
INSTALL (TARGETS Nextcloud.app)
|
||||||
|
|
||||||
|
|
|
@ -156,6 +156,7 @@ std::vector<WebDAVItem> SqliteConnector::getItemsChildren(const string &parentPa
|
||||||
|
|
||||||
void SqliteConnector::deleteChildren(const string &parentPath)
|
void SqliteConnector::deleteChildren(const string &parentPath)
|
||||||
{
|
{
|
||||||
|
//TODO missing the onces where parentPath is one folder deeper and also destroyed
|
||||||
open();
|
open();
|
||||||
int rs;
|
int rs;
|
||||||
sqlite3_stmt *stmt = 0;
|
sqlite3_stmt *stmt = 0;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "eventHandler.h"
|
#include "eventHandler.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <experimental/filesystem>
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -81,13 +82,11 @@ void WebDAV::logout(bool deleteFiles)
|
||||||
{
|
{
|
||||||
if (deleteFiles)
|
if (deleteFiles)
|
||||||
{
|
{
|
||||||
string cmd = "rm -rf " + Util::accessConfig<string>(Action::IReadString, "storageLocation",{}) + "/" +
|
std::experimental::filesystem::remove_all(Util::accessConfig<string>(Action::IReadString, "storageLocation",{}) + "/" + Util::accessConfig<string>(Action::IReadString,"UUID",{}) + '/');
|
||||||
Util::accessConfig<string>(Action::IReadString,"UUID",{}) + '/';
|
|
||||||
system(cmd.c_str());
|
|
||||||
}
|
}
|
||||||
remove(CONFIG_PATH.c_str());
|
std::experimental::filesystem::remove(CONFIG_PATH.c_str());
|
||||||
remove((CONFIG_PATH + ".back.").c_str());
|
std::experimental::filesystem::remove((CONFIG_PATH + ".back.").c_str());
|
||||||
remove(DB_PATH.c_str());
|
std::experimental::filesystem::remove(DB_PATH.c_str());
|
||||||
_url = "";
|
_url = "";
|
||||||
_password = "";
|
_password = "";
|
||||||
_username = "";
|
_username = "";
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "fileView.h"
|
#include "fileView.h"
|
||||||
#include "fileModel.h"
|
#include "fileModel.h"
|
||||||
|
|
||||||
|
#include <experimental/filesystem>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
@ -289,16 +290,11 @@ void EventHandler::contextMenuHandler(const int index)
|
||||||
{
|
{
|
||||||
if (_webDAVView->getCurrentEntry().type == Itemtype::IFOLDER)
|
if (_webDAVView->getCurrentEntry().type == Itemtype::IFOLDER)
|
||||||
{
|
{
|
||||||
Message(ICON_ERROR, "Error", "Currently only files can be deleted.", 2000);
|
std::experimental::filesystem::remove_all(_webDAVView->getCurrentEntry().localPath);
|
||||||
//string cmd = "rm -rf " + _webDAVView->getCurrentEntry().localPath + '/';
|
|
||||||
//if (rmdir((_webDAVView->getCurrentEntry().localPath + '/').c_str()) == 0)
|
|
||||||
//Log::writeInfoLog("okay");
|
|
||||||
//if (system(cmd.c_str()) == 0)
|
|
||||||
//Log::writeInfoLog("success");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
remove(_webDAVView->getCurrentEntry().localPath.c_str());
|
std::experimental::filesystem::remove(_webDAVView->getCurrentEntry().localPath);
|
||||||
}
|
}
|
||||||
vector<WebDAVItem> currentWebDAVItems = _sqllite.getItemsChildren(_currentPath);
|
vector<WebDAVItem> currentWebDAVItems = _sqllite.getItemsChildren(_currentPath);
|
||||||
updateItems(currentWebDAVItems);
|
updateItems(currentWebDAVItems);
|
||||||
|
@ -306,7 +302,7 @@ void EventHandler::contextMenuHandler(const int index)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Message(ICON_ERROR, "Error", "File is not available.", 1000);
|
Message(ICON_ERROR, "Error", "File is not available locally.", 1000);
|
||||||
_webDAVView->invertCurrentEntryColor();
|
_webDAVView->invertCurrentEntryColor();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue