diff options
author | saturneric <[email protected]> | 2023-12-04 15:08:39 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2023-12-04 15:08:39 +0000 |
commit | 2fc77533c039ac2e77240dc4b434c84109c6e643 (patch) | |
tree | 70a2d33956f81f19dcd22264828b18f4fa62d731 /src/core/function/gpg/GpgFileOpera.cpp | |
parent | fix: slove some ui issues (diff) | |
download | GpgFrontend-2fc77533c039ac2e77240dc4b434c84109c6e643.tar.gz GpgFrontend-2fc77533c039ac2e77240dc4b434c84109c6e643.zip |
feat: convert basic opera to async style
Diffstat (limited to 'src/core/function/gpg/GpgFileOpera.cpp')
-rw-r--r-- | src/core/function/gpg/GpgFileOpera.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/core/function/gpg/GpgFileOpera.cpp b/src/core/function/gpg/GpgFileOpera.cpp index 8d5e3369..bce3fcd8 100644 --- a/src/core/function/gpg/GpgFileOpera.cpp +++ b/src/core/function/gpg/GpgFileOpera.cpp @@ -36,32 +36,32 @@ auto GpgFrontend::GpgFileOpera::EncryptFile(KeyListPtr keys, const std::string& out_path, GpgEncrResult& result, int _channel) -> GpgFrontend::GpgError { -#ifdef WINDOWS - auto in_path_std = - std::filesystem::path(QString::fromStdString(in_path).toStdU16String()); - auto out_path_std = - std::filesystem::path(QString::fromStdString(out_path).toStdU16String()); -#else - auto in_path_std = std::filesystem::path(in_path); - auto out_path_std = std::filesystem::path(out_path); -#endif - - std::string in_buffer; - if (!ReadFileStd(in_path_std, in_buffer)) { - throw std::runtime_error("read file error"); - } - - ByteArrayPtr out_buffer = nullptr; - - auto err = GpgBasicOperator::GetInstance(_channel).Encrypt( - std::move(keys), in_buffer, out_buffer, result); - - if (CheckGpgError(err) == GPG_ERR_NO_ERROR) - if (!WriteFileStd(out_path_std, *out_buffer)) { - throw std::runtime_error("WriteBufferToFile error"); - }; - - return err; + // #ifdef WINDOWS + // auto in_path_std = + // std::filesystem::path(QString::fromStdString(in_path).toStdU16String()); + // auto out_path_std = + // std::filesystem::path(QString::fromStdString(out_path).toStdU16String()); + // #else + // auto in_path_std = std::filesystem::path(in_path); + // auto out_path_std = std::filesystem::path(out_path); + // #endif + + // std::string in_buffer; + // if (!ReadFileStd(in_path_std, in_buffer)) { + // throw std::runtime_error("read file error"); + // } + + // ByteArrayPtr out_buffer = nullptr; + + // auto err = GpgBasicOperator::GetInstance(_channel).Encrypt( + // std::move(keys), in_buffer, out_buffer, result); + + // if (CheckGpgError(err) == GPG_ERR_NO_ERROR) + // if (!WriteFileStd(out_path_std, *out_buffer)) { + // throw std::runtime_error("WriteBufferToFile error"); + // }; + + // return err; } auto GpgFrontend::GpgFileOpera::DecryptFile(const std::string& in_path, |