From 5efbbaa90166a4ab0484df794d87441ebf43f162 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Fri, 29 Dec 2023 00:26:24 +0100 Subject: [PATCH] fixed for self update --- src/Update.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Update.cpp b/src/Update.cpp index 9342ad66..05387557 100644 --- a/src/Update.cpp +++ b/src/Update.cpp @@ -115,12 +115,12 @@ void Update::PerformUpdate(const std::string& InvokedAs) { while (std::getline(OsRelease, Line)) { if (Line.starts_with("ID=")) { DistroID = Line.substr(3); - } else if (Line.starts_with("VERSION_ID=")) { - DistroVersion = Line.substr(strlen("VERSION_ID=")); } else if (Line.starts_with("VERSION_ID=\"")) { - DistroVersion = Line.substr(strlen("VERSION_ID=")); + DistroVersion = Line.substr(strlen("VERSION_ID=\"")); // skip closing quote DistroVersion = DistroVersion.substr(0, DistroVersion.size() - 1); + } else if (Line.starts_with("VERSION_ID=")) { + DistroVersion = Line.substr(strlen("VERSION_ID=")); } } } @@ -232,10 +232,9 @@ void Update::PerformUpdate(const std::string& InvokedAs) { auto DeleteMe = InvokedAs + ".delete_me"; std::filesystem::rename(InvokedAs, DeleteMe); std::filesystem::rename(Temp, InvokedAs); - std::wstring Wide(DeleteMe.begin(), DeleteMe.end()); - int Attr = GetFileAttributes(Wide.c_str()); + int Attr = GetFileAttributesA(DeleteMe.c_str()); if ((Attr & FILE_ATTRIBUTE_HIDDEN) == 0) { - SetFileAttributes(Wide.c_str(), Attr | FILE_ATTRIBUTE_HIDDEN); + SetFileAttributesA(DeleteMe.c_str(), Attr | FILE_ATTRIBUTE_HIDDEN); } #else beammp_error("Not implemented");