From 81310627fe2d8735b2d728d2052ac4576825727c Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Sun, 28 Jan 2024 17:47:33 +0800 Subject: [PATCH] fix mpv conf write --- source/player.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/player.cpp b/source/player.cpp index 39ce20f..64fdb69 100644 --- a/source/player.cpp +++ b/source/player.cpp @@ -401,7 +401,7 @@ void Player::writeMpvConf() { auto inputConf = path / "input.conf"; if (!std::filesystem::exists(mpvConf)) { - std::ofstream file(mpvConf); + std::ofstream file(mpvConf, std::ios::binary); auto content = romfs::get("mpv/mpv.conf"); file.write(reinterpret_cast(content.data()), content.size()) << "\n"; file << "# use opengl-hq video output for high-quality video rendering.\n"; @@ -412,7 +412,7 @@ void Player::writeMpvConf() { } if (!std::filesystem::exists(inputConf)) { - std::ofstream file(inputConf); + std::ofstream file(inputConf, std::ios::binary); auto content = romfs::get("mpv/input.conf"); file.write(reinterpret_cast(content.data()), content.size()) << "\n"; file << "MBTN_RIGHT script-message-to implay context-menu # show context menu\n"; @@ -433,9 +433,9 @@ void Player::writeMpvConf() { auto oscLua = scrips / "osc.lua"; if (!std::filesystem::exists(oscLua)) { - std::ofstream file(oscLua); - auto content = romfs::get("mpv/osc.lua"); - file.write(reinterpret_cast(content.data()), content.size()) << "\n"; + std::ofstream file(oscLua, std::ios::binary); + auto content = romfs::get("mpv/osc.lua").span(); + file.write(content.data(), content.size()); } }