mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-04 00:36:14 +00:00
fixed for self update
This commit is contained in:
parent
38494bb33a
commit
5efbbaa901
@ -115,12 +115,12 @@ void Update::PerformUpdate(const std::string& InvokedAs) {
|
|||||||
while (std::getline(OsRelease, Line)) {
|
while (std::getline(OsRelease, Line)) {
|
||||||
if (Line.starts_with("ID=")) {
|
if (Line.starts_with("ID=")) {
|
||||||
DistroID = Line.substr(3);
|
DistroID = Line.substr(3);
|
||||||
} else if (Line.starts_with("VERSION_ID=")) {
|
|
||||||
DistroVersion = Line.substr(strlen("VERSION_ID="));
|
|
||||||
} else if (Line.starts_with("VERSION_ID=\"")) {
|
} else if (Line.starts_with("VERSION_ID=\"")) {
|
||||||
DistroVersion = Line.substr(strlen("VERSION_ID="));
|
DistroVersion = Line.substr(strlen("VERSION_ID=\""));
|
||||||
// skip closing quote
|
// skip closing quote
|
||||||
DistroVersion = DistroVersion.substr(0, DistroVersion.size() - 1);
|
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";
|
auto DeleteMe = InvokedAs + ".delete_me";
|
||||||
std::filesystem::rename(InvokedAs, DeleteMe);
|
std::filesystem::rename(InvokedAs, DeleteMe);
|
||||||
std::filesystem::rename(Temp, InvokedAs);
|
std::filesystem::rename(Temp, InvokedAs);
|
||||||
std::wstring Wide(DeleteMe.begin(), DeleteMe.end());
|
int Attr = GetFileAttributesA(DeleteMe.c_str());
|
||||||
int Attr = GetFileAttributes(Wide.c_str());
|
|
||||||
if ((Attr & FILE_ATTRIBUTE_HIDDEN) == 0) {
|
if ((Attr & FILE_ATTRIBUTE_HIDDEN) == 0) {
|
||||||
SetFileAttributes(Wide.c_str(), Attr | FILE_ATTRIBUTE_HIDDEN);
|
SetFileAttributesA(DeleteMe.c_str(), Attr | FILE_ATTRIBUTE_HIDDEN);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
beammp_error("Not implemented");
|
beammp_error("Not implemented");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user