aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/GpgFrontend.h.in1
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/core/GpgConstants.cpp9
-rw-r--r--src/init.cpp8
-rw-r--r--src/main.cpp2
-rw-r--r--src/ui/main_window/MainWindowFileSlotFunction.cpp16
-rw-r--r--src/ui/settings/GlobalSettingStation.cpp14
-rw-r--r--src/ui/settings/GlobalSettingStation.h62
-rw-r--r--src/ui/thread/FileReadThread.cpp4
-rw-r--r--src/ui/widgets/FilePage.cpp19
-rw-r--r--src/ui/widgets/FilePage.h6
-rw-r--r--src/ui/widgets/PlainTextEditorPage.cpp1
13 files changed, 72 insertions, 74 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 67f8ba2b..4661afe6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -403,7 +403,7 @@ elseif (TEST_CORE_BUILD)
endif ()
# Introduce boost
-find_package(Boost COMPONENTS date_time filesystem REQUIRED)
+find_package(Boost COMPONENTS date_time REQUIRED)
# Introduce OpenSSL
find_package(OpenSSL REQUIRED)
diff --git a/src/GpgFrontend.h.in b/src/GpgFrontend.h.in
index b71b3df8..4de8d55c 100644
--- a/src/GpgFrontend.h.in
+++ b/src/GpgFrontend.h.in
@@ -31,6 +31,7 @@
// standard headers
#include <cstdint>
+#include <filesystem>
#ifdef WINDOWS
#include <winsock2.h>
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 5fd37a18..607119b4 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -40,7 +40,7 @@ set(GPGME_LIB_DIR ${UTILS_DIR}/gpgme/lib)
# link third-party libraries
target_link_libraries(gpgfrontend_core easyloggingpp config++)
# link boost libraries
-target_link_libraries(gpgfrontend_core Boost::date_time Boost::filesystem)
+target_link_libraries(gpgfrontend_core Boost::date_time)
# link gnupg libraries
target_link_libraries(gpgfrontend_core gpgme assuan gpg-error)
# link openssl
diff --git a/src/core/GpgConstants.cpp b/src/core/GpgConstants.cpp
index 8617e2b9..f35c257d 100644
--- a/src/core/GpgConstants.cpp
+++ b/src/core/GpgConstants.cpp
@@ -31,7 +31,6 @@
#include <gpg-error.h>
#include <boost/algorithm/string/predicate.hpp>
-#include <boost/filesystem.hpp>
#include <string>
const char* GpgFrontend::GpgConstants::PGP_CRYPT_BEGIN =
@@ -116,7 +115,7 @@ static inline std::string trim(std::string& s) {
}
std::string GpgFrontend::read_all_data_in_file(const std::string& utf8_path) {
- using namespace boost::filesystem;
+ using namespace std::filesystem;
class path file_info(utf8_path.c_str());
if (!exists(file_info) || !is_regular_file(file_info)) return {};
std::ifstream in_file;
@@ -135,7 +134,7 @@ std::string GpgFrontend::read_all_data_in_file(const std::string& utf8_path) {
bool GpgFrontend::write_buffer_to_file(const std::string& utf8_path,
const std::string& out_buffer) {
- using namespace boost::filesystem;
+ using namespace std::filesystem;
class path file_info(utf8_path.c_str());
#ifndef WINDOWS
std::ofstream out_file(file_info.string(), std::ios::out | std::ios::trunc);
@@ -151,7 +150,7 @@ bool GpgFrontend::write_buffer_to_file(const std::string& utf8_path,
std::string GpgFrontend::get_file_extension(const std::string& path) {
// Create a path object from given string
- boost::filesystem::path path_obj(path);
+ std::filesystem::path path_obj(path);
// Check if file name in the path object has extension
if (path_obj.has_extension()) {
@@ -164,7 +163,7 @@ std::string GpgFrontend::get_file_extension(const std::string& path) {
std::string GpgFrontend::get_only_file_name_with_path(const std::string& path) {
// Create a path object from given string
- boost::filesystem::path path_obj(path);
+ std::filesystem::path path_obj(path);
// Check if file name in the path object has extension
if (path_obj.has_filename()) {
// Fetch the extension from path object and return
diff --git a/src/init.cpp b/src/init.cpp
index d95a3351..b1ea8df8 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -34,11 +34,11 @@
* @brief Get the files of a given directory
*
* @param _path target directory
- * @return std::vector<boost::filesystem::path>
+ * @return std::vector<std::filesystem::path>
*/
-std::vector<boost::filesystem::path> get_files_of_directory(
- const boost::filesystem::path& _path) {
- namespace fs = boost::filesystem;
+std::vector<std::filesystem::path> get_files_of_directory(
+ const std::filesystem::path& _path) {
+ namespace fs = std::filesystem;
std::vector<fs::path> path_list;
if (!_path.empty()) {
fs::recursive_directory_iterator end;
diff --git a/src/main.cpp b/src/main.cpp
index 949ec949..7e65a847 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -132,7 +132,7 @@ int main(int argc, char* argv[]) {
#if !defined(RELEASE) && defined(WINDOWS)
// css
- boost::filesystem::path css_path =
+ std::filesystem::path css_path =
GpgFrontend::UI::GlobalSettingStation::GetInstance().GetResourceDir() /
"css" / "default.qss";
QFile file(css_path.string().c_str());
diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp
index 5d8db757..39d772a8 100644
--- a/src/ui/main_window/MainWindowFileSlotFunction.cpp
+++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp
@@ -87,7 +87,7 @@ void MainWindow::SlotFileEncrypt() {
auto out_path = path + _extension;
if (QFile::exists(out_path)) {
- boost::filesystem::path _out_path = out_path.toStdString();
+ std::filesystem::path _out_path = out_path.toStdString();
auto out_file_name = boost::format(_("The target file %1% already exists, "
"do you need to overwrite it?")) %
_out_path.filename();
@@ -162,7 +162,7 @@ void MainWindow::SlotFileDecrypt() {
if (!file_pre_check(this, path)) return;
- boost::filesystem::path out_path = path.toStdString();
+ std::filesystem::path out_path = path.toStdString();
if (out_path.extension() == ".asc" || out_path.extension() == ".gpg") {
out_path = out_path.parent_path() / out_path.stem();
@@ -248,7 +248,7 @@ void MainWindow::SlotFileSign() {
_extension = ".sig";
}
- boost::filesystem::path in_path = path.toStdString();
+ std::filesystem::path in_path = path.toStdString();
auto sig_file_path = in_path;
sig_file_path += _extension;
if (exists(sig_file_path)) {
@@ -295,8 +295,8 @@ void MainWindow::SlotFileVerify() {
auto fileTreeView = edit_->SlotCurPageFileTreeView();
auto path = fileTreeView->GetSelected();
- boost::filesystem::path in_path = path.toStdString();
- boost::filesystem::path sign_file_path = in_path, data_file_path;
+ std::filesystem::path in_path = path.toStdString();
+ std::filesystem::path sign_file_path = in_path, data_file_path;
// Detect ascii mode
auto& settings = GlobalSettingStation::GetInstance().GetUISettings();
@@ -422,7 +422,7 @@ void MainWindow::SlotFileEncryptSign() {
_extension = ".gpg";
}
- boost::filesystem::path out_path = path.toStdString() + _extension;
+ std::filesystem::path out_path = path.toStdString() + _extension;
if (exists(out_path)) {
auto ret = QMessageBox::warning(
@@ -480,8 +480,8 @@ void MainWindow::SlotFileDecryptVerify() {
if (!file_pre_check(this, path)) return;
- boost::filesystem::path in_path(path.toStdString());
- boost::filesystem::path out_path = in_path;
+ std::filesystem::path in_path(path.toStdString());
+ std::filesystem::path out_path = in_path;
if (in_path.extension() == ".asc" || in_path.extension() == ".gpg") {
out_path = in_path.parent_path() / out_path.stem();
} else {
diff --git a/src/ui/settings/GlobalSettingStation.cpp b/src/ui/settings/GlobalSettingStation.cpp
index 5401536f..ee1a9351 100644
--- a/src/ui/settings/GlobalSettingStation.cpp
+++ b/src/ui/settings/GlobalSettingStation.cpp
@@ -61,7 +61,7 @@ void GpgFrontend::UI::GlobalSettingStation::SyncSettings() noexcept {
}
GpgFrontend::UI::GlobalSettingStation::GlobalSettingStation() noexcept {
- using namespace boost::filesystem;
+ using namespace std::filesystem;
using namespace libconfig;
el::Loggers::addFlag(el::LoggingFlag::AutoSpacing);
@@ -128,7 +128,7 @@ GpgFrontend::UI::GlobalSettingStation::GlobalSettingStation() noexcept {
}
void GpgFrontend::UI::GlobalSettingStation::AddRootCert(
- const boost::filesystem::path &path) {
+ const std::filesystem::path &path) {
std::string out_buffer;
if (!FileOperator::ReadFileStd(path.string(), out_buffer)) {
@@ -189,9 +189,9 @@ GpgFrontend::UI::GlobalSettingStation::generate_passphrase(int len) {
void GpgFrontend::UI::GlobalSettingStation::init_app_secure_key() {
GpgFrontend::write_buffer_to_file(app_secure_key_path_.string(),
generate_passphrase(256));
- boost::filesystem::permissions(app_secure_key_path_,
- boost::filesystem::owner_read |
- boost::filesystem::owner_write);
+ std::filesystem::permissions(app_secure_key_path_,
+ std::filesystem::perms::owner_read |
+ std::filesystem::perms::owner_write);
}
std::string GpgFrontend::UI::GlobalSettingStation::SaveDataObj(
@@ -238,7 +238,7 @@ GpgFrontend::UI::GlobalSettingStation::GetDataObject(const std::string &_key) {
const auto obj_path = app_data_objs_path_ / _hash_obj_key;
- if (!boost::filesystem::exists(obj_path)) {
+ if (!std::filesystem::exists(obj_path)) {
return {};
}
@@ -270,7 +270,7 @@ GpgFrontend::UI::GlobalSettingStation::GetDataObjectByRef(
auto _hash_obj_key = _ref;
const auto obj_path = app_data_objs_path_ / _hash_obj_key;
- if (!boost::filesystem::exists(obj_path))
+ if (!std::filesystem::exists(obj_path))
return {};
std::string buffer;
diff --git a/src/ui/settings/GlobalSettingStation.h b/src/ui/settings/GlobalSettingStation.h
index 1189dfe3..3d9f4024 100644
--- a/src/ui/settings/GlobalSettingStation.h
+++ b/src/ui/settings/GlobalSettingStation.h
@@ -81,28 +81,28 @@ public:
/**
* @brief Get the App Dir object
*
- * @return boost::filesystem::path
+ * @return std::filesystem::path
*/
- [[nodiscard]] boost::filesystem::path GetAppDir() const { return app_path_; }
+ [[nodiscard]] std::filesystem::path GetAppDir() const { return app_path_; }
/**
* @brief Get the Log Dir object
*
- * @return boost::filesystem::path
+ * @return std::filesystem::path
*/
- [[nodiscard]] boost::filesystem::path GetLogDir() const {
+ [[nodiscard]] std::filesystem::path GetLogDir() const {
return app_log_path_;
}
/**
* @brief Get the Standalone Database Dir object
*
- * @return boost::filesystem::path
+ * @return std::filesystem::path
*/
- [[nodiscard]] boost::filesystem::path GetStandaloneDatabaseDir() const {
+ [[nodiscard]] std::filesystem::path GetStandaloneDatabaseDir() const {
auto db_path = app_configure_path_ / "db";
- if (!boost::filesystem::exists(db_path)) {
- boost::filesystem::create_directory(db_path);
+ if (!std::filesystem::exists(db_path)) {
+ std::filesystem::create_directory(db_path);
}
return db_path;
}
@@ -110,36 +110,36 @@ public:
/**
* @brief Get the Standalone Gpg Bin Dir object
*
- * @return boost::filesystem::path
+ * @return std::filesystem::path
*/
- [[nodiscard]] boost::filesystem::path GetStandaloneGpgBinDir() const {
+ [[nodiscard]] std::filesystem::path GetStandaloneGpgBinDir() const {
return app_resource_path_ / "gpg1.4" / "gpg";
}
/**
* @brief Get the Locale Dir object
*
- * @return boost::filesystem::path
+ * @return std::filesystem::path
*/
- [[nodiscard]] boost::filesystem::path GetLocaleDir() const {
+ [[nodiscard]] std::filesystem::path GetLocaleDir() const {
return app_locale_path_;
}
/**
* @brief Get the Resource Dir object
*
- * @return boost::filesystem::path
+ * @return std::filesystem::path
*/
- [[nodiscard]] boost::filesystem::path GetResourceDir() const {
+ [[nodiscard]] std::filesystem::path GetResourceDir() const {
return app_resource_path_;
}
/**
* @brief Get the Certs Dir object
*
- * @return boost::filesystem::path
+ * @return std::filesystem::path
*/
- [[nodiscard]] boost::filesystem::path GetCertsDir() const {
+ [[nodiscard]] std::filesystem::path GetCertsDir() const {
return app_resource_path_ / "certs";
}
@@ -158,7 +158,7 @@ public:
*
* @param path
*/
- void AddRootCert(const boost::filesystem::path &path);
+ void AddRootCert(const std::filesystem::path &path);
/**
* @brief Get the Root Certs object
@@ -206,44 +206,44 @@ public:
std::optional<nlohmann::json> GetDataObjectByRef(const std::string &_ref);
private:
- boost::filesystem::path app_path_ =
+ std::filesystem::path app_path_ =
qApp->applicationDirPath().toStdString(); ///< Program Location
- boost::filesystem::path app_data_path_ =
+ std::filesystem::path app_data_path_ =
QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)
.toStdString(); ///< Program Data Location
- boost::filesystem::path app_log_path_ =
+ std::filesystem::path app_log_path_ =
app_data_path_ / "logs"; ///< Program Data Location
- boost::filesystem::path app_data_objs_path_ =
+ std::filesystem::path app_data_objs_path_ =
app_data_path_ / "objs"; ///< Object storage path
#ifdef LINUX_INSTALL_BUILD
- boost::filesystem::path app_resource_path_ =
- boost::filesystem::path(APP_LOCALSTATE_PATH) /
+ std::filesystem::path app_resource_path_ =
+ std::filesystem::path(APP_LOCALSTATE_PATH) /
"gpgfrontend"; ///< Program Data Location
#else
- boost::filesystem::path app_resource_path_ =
+ std::filesystem::path app_resource_path_ =
RESOURCE_DIR_BOOST_PATH(app_path_); ///< Program Data Location
#endif
#ifdef LINUX_INSTALL_BUILD
- boost::filesystem::path app_locale_path_ =
+ std::filesystem::path app_locale_path_ =
std::string(APP_LOCALE_PATH); ///< Program Data Location
#else
- boost::filesystem::path app_locale_path_ =
+ std::filesystem::path app_locale_path_ =
app_resource_path_ / "locales"; ///< Program Data Location
#endif
- boost::filesystem::path app_configure_path_ =
+ std::filesystem::path app_configure_path_ =
QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation)
.toStdString(); ///< Program Configure Location
- boost::filesystem::path app_secure_path_ =
+ std::filesystem::path app_secure_path_ =
app_configure_path_ / "secure"; ///< Where sensitive information is stored
- boost::filesystem::path app_secure_key_path_ =
+ std::filesystem::path app_secure_key_path_ =
app_secure_path_ / "app.key"; ///<
- boost::filesystem::path ui_config_dir_path_ =
+ std::filesystem::path ui_config_dir_path_ =
app_configure_path_ /
"UserInterface"; ///< Configure File Directory Location
- boost::filesystem::path ui_config_path_ =
+ std::filesystem::path ui_config_path_ =
ui_config_dir_path_ / "ui.cfg"; ///< UI Configure File Location
libconfig::Config ui_cfg_; ///<
diff --git a/src/ui/thread/FileReadThread.cpp b/src/ui/thread/FileReadThread.cpp
index 1ed9ae60..b0eae355 100644
--- a/src/ui/thread/FileReadThread.cpp
+++ b/src/ui/thread/FileReadThread.cpp
@@ -26,7 +26,7 @@
#include "FileReadThread.h"
-#include <boost/filesystem.hpp>
+
#include <utility>
namespace GpgFrontend::UI {
@@ -37,7 +37,7 @@ FileReadThread::FileReadThread(std::string path) : path_(std::move(path)) {
void FileReadThread::run() {
LOG(INFO) << "started";
- boost::filesystem::path read_file_path(this->path_);
+ std::filesystem::path read_file_path(this->path_);
if (is_regular_file(read_file_path)) {
LOG(INFO) << "read open";
diff --git a/src/ui/widgets/FilePage.cpp b/src/ui/widgets/FilePage.cpp
index 43b1cd3e..8f562f85 100644
--- a/src/ui/widgets/FilePage.cpp
+++ b/src/ui/widgets/FilePage.cpp
@@ -28,7 +28,6 @@
#include "ui/widgets/FilePage.h"
-#include <boost/filesystem.hpp>
#include <string>
#include "main_window/MainWindow.h"
@@ -50,7 +49,7 @@ FilePage::FilePage(QWidget* parent)
ui_->fileTreeView->setModel(dir_model_);
ui_->fileTreeView->setColumnWidth(0, 320);
ui_->fileTreeView->sortByColumn(0, Qt::AscendingOrder);
- m_path_ = boost::filesystem::path(dir_model_->rootPath().toStdString());
+ m_path_ = std::filesystem::path(dir_model_->rootPath().toStdString());
create_popup_menu();
@@ -98,7 +97,7 @@ FilePage::FilePage(QWidget* parent)
}
void FilePage::slot_file_tree_view_item_clicked(const QModelIndex& index) {
- selected_path_ = boost::filesystem::path(
+ selected_path_ = std::filesystem::path(
dir_model_->fileInfo(index).absoluteFilePath().toStdString());
m_path_ = selected_path_;
LOG(INFO) << "selected path" << selected_path_;
@@ -109,7 +108,7 @@ void FilePage::slot_up_level() {
auto utf8_path =
dir_model_->fileInfo(currentRoot).absoluteFilePath().toStdString();
- boost::filesystem::path path_obj(utf8_path);
+ std::filesystem::path path_obj(utf8_path);
m_path_ = path_obj;
LOG(INFO) << "get path" << m_path_;
@@ -138,19 +137,19 @@ QString FilePage::GetSelected() const {
void FilePage::SlotGoPath() {
const auto path_edit = ui_->pathEdit->text().toStdString();
- boost::filesystem::path path_obj(path_edit);
+ std::filesystem::path path_obj(path_edit);
if (m_path_.string() != path_edit) m_path_ = path_obj;
auto fileInfo = QFileInfo(m_path_.string().c_str());
if (fileInfo.isDir() && fileInfo.isReadable() && fileInfo.isExecutable()) {
- m_path_ = boost::filesystem::path(fileInfo.filePath().toStdString());
+ m_path_ = std::filesystem::path(fileInfo.filePath().toStdString());
LOG(INFO) << "set path" << m_path_;
ui_->fileTreeView->setRootIndex(dir_model_->index(fileInfo.filePath()));
dir_model_->setRootPath(fileInfo.filePath());
for (int i = 1; i < dir_model_->columnCount(); ++i) {
ui_->fileTreeView->resizeColumnToContents(i);
}
- ui_->pathEdit->setText(m_path_.generic_path().string().c_str());
+ ui_->pathEdit->setText(m_path_.generic_string().c_str());
} else {
QMessageBox::critical(
this, _("Error"),
@@ -245,7 +244,7 @@ void FilePage::create_popup_menu() {
void FilePage::onCustomContextMenu(const QPoint& point) {
QModelIndex index = ui_->fileTreeView->indexAt(point);
- selected_path_ = boost::filesystem::path(
+ selected_path_ = std::filesystem::path(
dir_model_->fileInfo(index).absoluteFilePath().toStdString());
LOG(INFO) << "right click" << selected_path_;
if (index.isValid()) {
@@ -322,7 +321,7 @@ void FilePage::slot_rename_item() {
try {
new_name_path /= text.toStdString();
LOG(INFO) << "new name path" << new_name_path;
- boost::filesystem::rename(old_name_path, new_name_path);
+ std::filesystem::rename(old_name_path, new_name_path);
// refresh
this->SlotGoPath();
} catch (...) {
@@ -440,7 +439,7 @@ void FilePage::slot_mkdir() {
void FilePage::slot_create_empty_file() {
auto root_path_str = dir_model_->rootPath().toStdString();
- boost::filesystem::path root_path(root_path_str);
+ std::filesystem::path root_path(root_path_str);
QString new_file_name;
bool ok;
diff --git a/src/ui/widgets/FilePage.h b/src/ui/widgets/FilePage.h
index 7c1880ee..c99aeab6 100644
--- a/src/ui/widgets/FilePage.h
+++ b/src/ui/widgets/FilePage.h
@@ -29,7 +29,7 @@
#ifndef GPGFRONTEND_FILEPAGE_H
#define GPGFRONTEND_FILEPAGE_H
-#include <boost/filesystem.hpp>
+
#include "ui/GpgFrontendUI.h"
#include "ui/widgets/InfoBoardWidget.h"
@@ -200,8 +200,8 @@ class FilePage : public QWidget {
QCompleter* path_edit_completer_; ///<
QStringListModel* path_complete_model_; ///<
- boost::filesystem::path m_path_; ///<
- boost::filesystem::path selected_path_; ///<
+ std::filesystem::path m_path_; ///<
+ std::filesystem::path selected_path_; ///<
QMenu* popup_menu_{}; ///<
QMenu* option_popup_menu_{}; ///<
diff --git a/src/ui/widgets/PlainTextEditorPage.cpp b/src/ui/widgets/PlainTextEditorPage.cpp
index c9a870c9..2a6413bd 100644
--- a/src/ui/widgets/PlainTextEditorPage.cpp
+++ b/src/ui/widgets/PlainTextEditorPage.cpp
@@ -28,7 +28,6 @@
#include <encoding-detect/TextEncodingDetect.h>
-#include <boost/filesystem.hpp>
#include <boost/format.hpp>
#include <utility>