aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function/DataObjectOperator.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2022-03-19 06:09:55 +0000
committerSaturneric <[email protected]>2022-03-19 06:09:55 +0000
commitdad03e9ccc57da0a04d058ec418ce0068ce3841d (patch)
treee3d6bec71f3c070139ef5dfa7cca0cf70acb4dd1 /src/core/function/DataObjectOperator.cpp
parent<fix>(ui): Fix the problem that the file cannot be signed (diff)
downloadGpgFrontend-dad03e9ccc57da0a04d058ec418ce0068ce3841d.tar.gz
GpgFrontend-dad03e9ccc57da0a04d058ec418ce0068ce3841d.zip
<fix>(core, ui): Fix path double-byte encoding problem under Windows
Diffstat (limited to 'src/core/function/DataObjectOperator.cpp')
-rw-r--r--src/core/function/DataObjectOperator.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/function/DataObjectOperator.cpp b/src/core/function/DataObjectOperator.cpp
index a3f7fc70..1e216dd6 100644
--- a/src/core/function/DataObjectOperator.cpp
+++ b/src/core/function/DataObjectOperator.cpp
@@ -51,7 +51,7 @@ GpgFrontend::DataObjectOperator::DataObjectOperator(int channel)
}
std::string key;
- if (!FileOperator::ReadFileStd(app_secure_key_path_.string(), key)) {
+ if (!FileOperator::ReadFileStd(app_secure_key_path_.u8string(), key)) {
LOG(FATAL) << _("Failed to read app secure key file")
<< app_secure_key_path_;
throw std::runtime_error(_("Failed to read app secure key file"));
@@ -94,7 +94,7 @@ std::string GpgFrontend::DataObjectOperator::SaveDataObj(
LOG(INFO) << _("Saving data object") << _hash_obj_key << "to" << obj_path << encoded.size() << "bytes";
- FileOperator::WriteFileStd(obj_path.string(), encoded.toStdString());
+ FileOperator::WriteFileStd(obj_path.u8string(), encoded.toStdString());
return _key.empty() ? _hash_obj_key : std::string();
}
@@ -117,7 +117,7 @@ std::optional<nlohmann::json> GpgFrontend::DataObjectOperator::GetDataObject(
}
std::string buffer;
- if (!FileOperator::ReadFileStd(obj_path.string(), buffer)) {
+ if (!FileOperator::ReadFileStd(obj_path.u8string(), buffer)) {
LOG(ERROR) << _("Failed to read data object") << _key;
return {};
}
@@ -153,7 +153,7 @@ GpgFrontend::DataObjectOperator::GetDataObjectByRef(const std::string& _ref) {
if (!std::filesystem::exists(obj_path)) return {};
std::string buffer;
- if (!FileOperator::ReadFileStd(obj_path.string(), buffer)) return {};
+ if (!FileOperator::ReadFileStd(obj_path.u8string(), buffer)) return {};
auto encoded = QByteArray::fromStdString(buffer);
QAESEncryption encryption(QAESEncryption::AES_256, QAESEncryption::ECB,