diff --git a/src/ssh/sftp_client.cpp b/src/ssh/sftp_client.cpp index 19a3ced274..40638b71da 100644 --- a/src/ssh/sftp_client.cpp +++ b/src/ssh/sftp_client.cpp @@ -147,7 +147,7 @@ void SFTPClient::pull_file(const fs::path& source_path, const fs::path& target_p do_pull_file(source_path, *local_file); auto source_perms = mp_sftp_stat(sftp.get(), source_path.u8string().c_str())->permissions; - if (!MP_PLATFORM.set_permissions(QString::fromStdWString(target_path.wstring()), static_cast(source_perms))) + if (!MP_PLATFORM.set_permissions(QString::fromStdString(target_path.u8string()), static_cast(source_perms))) throw SFTPError{"cannot set permissions for local file {}", target_path}; if (local_file->fail()) @@ -301,7 +301,7 @@ bool SFTPClient::pull_dir(const fs::path& source_path, const fs::path& target_pa for (auto it = subdirectory_perms.crbegin(); it != subdirectory_perms.crend(); ++it) { const auto& [path, perms] = *it; - if (!MP_PLATFORM.set_permissions(QString::fromStdWString(path.wstring()), static_cast(perms))) + if (!MP_PLATFORM.set_permissions(QString::fromStdString(path.u8string()), static_cast(perms))) { mpl::log(mpl::Level::error, log_category, diff --git a/tests/test_sftp_client.cpp b/tests/test_sftp_client.cpp index 47f747e5f0..2a799b19ce 100644 --- a/tests/test_sftp_client.cpp +++ b/tests/test_sftp_client.cpp @@ -293,7 +293,7 @@ TEST_F(SFTPClient, pull_file_success) REPLACE(sftp_stat, [&](auto...) { return get_dummy_sftp_attr(SSH_FILEXFER_TYPE_REGULAR, "", perms); }); mp::Perms written_perms; EXPECT_CALL(mock_platform, - set_permissions(QString::fromStdWString(target_path.wstring()), static_cast(perms))) + set_permissions(QString::fromStdString(target_path.u8string()), static_cast(perms))) .WillOnce([&](auto, auto perms) { written_perms = perms; return true; @@ -361,7 +361,7 @@ TEST_F(SFTPClient, pull_file_cannot_write_target) }; REPLACE(sftp_read, mocked_sftp_read); REPLACE(sftp_stat, [&](auto...) { return get_dummy_sftp_attr(); }); - EXPECT_CALL(mock_platform, set_permissions(QString::fromStdWString(target_path.wstring()), _)) + EXPECT_CALL(mock_platform, set_permissions(QString::fromStdString(target_path.u8string()), _)) .WillOnce(Return(true)); REPLACE(sftp_setstat, [](auto...) { return SSH_FX_OK; }); @@ -402,7 +402,7 @@ TEST_F(SFTPClient, pull_file_cannot_set_perms) REPLACE(sftp_stat, [&](auto...) { return get_dummy_sftp_attr(SSH_FILEXFER_TYPE_REGULAR, "", perms); }); EXPECT_CALL(mock_platform, - set_permissions(QString::fromStdWString(target_path.wstring()), static_cast(perms))) + set_permissions(QString::fromStdString(target_path.u8string()), static_cast(perms))) .WillOnce(Return(false)); auto sftp_client = make_sftp_client(); @@ -751,13 +751,13 @@ TEST_F(SFTPClient, pull_dir_success_regular) mp::Perms dir_written_perms; EXPECT_CALL( mock_platform, - set_permissions(QString::fromStdWString((target_path / "file").wstring()), static_cast(perms))) + set_permissions(QString::fromStdString((target_path / "file").u8string()), static_cast(perms))) .WillOnce([&](auto, auto perms) { file_written_perms = perms; return true; }); EXPECT_CALL(mock_platform, - set_permissions(QString::fromStdWString(target_path.wstring()), static_cast(perms))) + set_permissions(QString::fromStdString(target_path.u8string()), static_cast(perms))) .WillOnce([&](auto, auto perms) { dir_written_perms = perms; return true;