Create shortcuts.vdf backup file

Should've thought of that... lol
pull/169/head
Peter Repukat 2 years ago
parent e4ffc86272
commit 49a4ea79e3

@ -268,7 +268,13 @@ bool UIModel::writeShortcutsVDF(const std::wstring& mode, const std::wstring& na
qDebug() << "Steam config Path: " << config_path;
qDebug() << "Trying to write config as admin: " << is_admin_try;
auto write_res = VDFParser::Parser::writeShortcuts(config_path, shortcuts_vdf_);
bool write_res;
try {
write_res = VDFParser::Parser::writeShortcuts(config_path, shortcuts_vdf_);
}
catch (const std::exception& e) {
qDebug() << "Couldn't backup shortcuts file: " << e.what();
}
if (!write_res && !is_admin_try) {
wchar_t szPath[MAX_PATH];

@ -271,8 +271,6 @@ struct VDFFile {
//{
// std::wstring res = L"[";
// res += L"]";
// return res;
//}
@ -474,6 +472,8 @@ class Parser {
static inline bool writeShortcuts(std::filesystem::path path, const VDFFile& vdffile)
{
const auto copied = std::filesystem::copy_file(path, path.string() + ".bak", std::filesystem::copy_options::update_existing);
ofile.open(path.string(), std::ios::binary | std::ios::out);
if (!ofile.is_open()) {
return false;

Loading…
Cancel
Save