diff --git a/src/platform/platform_unix.cpp b/src/platform/platform_unix.cpp index d5a88201b3..a0f643d154 100644 --- a/src/platform/platform_unix.cpp +++ b/src/platform/platform_unix.cpp @@ -64,7 +64,14 @@ bool mp::platform::Platform::set_permissions(const std::filesystem::path& path, std::error_code ec{}; std::filesystem::permissions(path, permissions, ec); - return !static_cast(ec); + if (ec) + { + mpl::log(mpl::Level::warning, + "permissions", + fmt::format("failed to set permissions for {}: {}", path.u8string(), ec.message())); + } + + return !ec; } bool mp::platform::Platform::symlink(const char* target, const char* link, bool is_dir) const diff --git a/tests/linux/test_platform_linux.cpp b/tests/linux/test_platform_linux.cpp index a6a7f0491e..962060e6b4 100644 --- a/tests/linux/test_platform_linux.cpp +++ b/tests/linux/test_platform_linux.cpp @@ -632,7 +632,7 @@ TEST_F(PlatformLinux, create_alias_script_overwrites) EXPECT_CALL(*mock_utils, make_file_with_content(_, _, true)).Times(1); EXPECT_CALL(*mock_file_ops, get_permissions(_)) - .WillOnce(Return(std::filesystem::perms::owner_read | std::filesystem::perms::owner_write)); + .WillOnce(Return(mp::fs::perms::owner_read | mp::fs::perms::owner_write)); EXPECT_CALL(*mock_platform, set_permissions(_, _)).WillOnce(Return(true)); // Calls the platform function directly since MP_PLATFORM is mocked. @@ -673,7 +673,7 @@ TEST_F(PlatformLinux, create_alias_script_throws_if_cannot_set_permissions) EXPECT_CALL(*mock_utils, make_file_with_content(_, _, true)).Times(1); EXPECT_CALL(*mock_file_ops, get_permissions(_)) - .WillOnce(Return(std::filesystem::perms::owner_read | std::filesystem::perms::owner_write)); + .WillOnce(Return(mp::fs::perms::owner_read | mp::fs::perms::owner_write)); EXPECT_CALL(*mock_platform, set_permissions(_, _)).WillOnce(Return(false)); MP_EXPECT_THROW_THAT(