diff options
author | Saturneric <[email protected]> | 2021-09-05 21:41:00 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-09-05 21:41:00 +0000 |
commit | e2d30cc0194db74b77e3c06dbaf9c597bb82c860 (patch) | |
tree | d9df5302e59c59135495ee81657422cebd7b6092 /src/gpg/function/GpgFileOpera.cpp | |
parent | Rewrite the core. (diff) | |
download | GpgFrontend-e2d30cc0194db74b77e3c06dbaf9c597bb82c860.tar.gz GpgFrontend-e2d30cc0194db74b77e3c06dbaf9c597bb82c860.zip |
Adjust the code structure.
Introduce log library.
Remove Qt from the core code.
Diffstat (limited to 'src/gpg/function/GpgFileOpera.cpp')
-rw-r--r-- | src/gpg/function/GpgFileOpera.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gpg/function/GpgFileOpera.cpp b/src/gpg/function/GpgFileOpera.cpp index 50e4e932..726c2695 100644 --- a/src/gpg/function/GpgFileOpera.cpp +++ b/src/gpg/function/GpgFileOpera.cpp @@ -23,14 +23,17 @@ */ #include "gpg/function/GpgFileOpera.h" #include "gpg/function/BasicOperator.h" + +#include <filesystem> #include <memory> GpgFrontend::GpgError GpgFrontend::GpgFileOpera::EncryptFile( KeyArgsList &keys, const std::string &path, GpgEncrResult &result) { - QFileInfo file_info(path.c_str()); + using namespace std::filesystem; + class path file_info(path.c_str()); - if (!file_info.isFile() || !file_info.isReadable()) + if (!exists(file_info) || !is_regular_file(path)) throw std::runtime_error("no permission"); QFile in_file(path.c_str()); @@ -59,7 +62,7 @@ GpgFrontend::GpgError GpgFrontend::GpgFileOpera::EncryptFile( } GpgFrontend::GpgError -GpgFrontend::GpgFileOpera::DecryptFile(const QString &path, +GpgFrontend::GpgFileOpera::DecryptFile(const std::string &path, GpgDecrResult &result) { QFileInfo file_info(path); |