Skip to content

Commit 4466950

Browse files
committed
feat: Support for Millennium 3.0.0
1 parent 8c0282e commit 4466950

2 files changed

Lines changed: 13 additions & 47 deletions

File tree

src/routes/installer.cc

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,6 @@ static bool UsesNewInstallLayout(const std::string& tagName)
204204
}
205205
}
206206

207-
static std::string GetLocalAppDataPath()
208-
{
209-
const char* localAppData = std::getenv("LOCALAPPDATA");
210-
return localAppData ? std::string(localAppData) : std::string();
211-
}
212-
213207
TaskScheduler::TaskResult InstallReleaseAssets(std::unique_ptr<double>& progress, const nlohmann::json& releaseInfo, const nlohmann::json& osReleaseInfo,
214208
const std::string& steamPath)
215209
{
@@ -222,30 +216,7 @@ TaskScheduler::TaskResult InstallReleaseAssets(std::unique_ptr<double>& progress
222216
std::string tagName = releaseInfo.contains("tag_name") ? releaseInfo["tag_name"].get<std::string>() : "";
223217

224218
if (UsesNewInstallLayout(tagName)) {
225-
std::string localAppData = GetLocalAppDataPath();
226-
if (localAppData.empty()) {
227-
return { false, "Failed to resolve %LOCALAPPDATA% path." };
228-
}
229-
230-
auto millenniumPath = std::filesystem::path(localAppData) / "Millennium";
231-
std::filesystem::create_directories(millenniumPath);
232-
233-
ExtractZippedArchive(fileName.string().c_str(), millenniumPath.string().c_str(), progress.get(), &currentFileProgress);
234-
235-
auto source = millenniumPath / "lib" / "millennium.bootstrap64.dll";
236-
auto dest = std::filesystem::path(steamPath) / "wsock32.dll";
237-
238-
if (!std::filesystem::exists(source)) {
239-
return { false, "millennium.bootstrap64.dll not found after extraction." };
240-
}
241-
242-
std::error_code ec;
243-
std::filesystem::remove(dest, ec);
244-
245-
std::filesystem::create_hard_link(source, dest, ec);
246-
if (ec) {
247-
return { false, std::format("Failed to create hardlink: {}", ec.message()) };
248-
}
219+
ExtractZippedArchive(fileName.string().c_str(), steamPath.c_str(), progress.get(), &currentFileProgress);
249220
} else {
250221
ExtractZippedArchive(fileName.string().c_str(), steamPath.c_str(), progress.get(), &currentFileProgress);
251222
}

src/routes/uninstall_select.cc

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,33 +108,23 @@ ComponentProps MakeComponentProps(std::vector<std::filesystem::path> pathList)
108108

109109
std::vector<std::pair<std::string, std::tuple<ComponentState, ComponentProps>>> uninstallComponents;
110110

111-
static std::filesystem::path GetMillenniumLocalPath()
112-
{
113-
const char* localAppData = std::getenv("LOCALAPPDATA");
114-
if (localAppData) {
115-
return std::filesystem::path(localAppData) / "Millennium";
116-
}
117-
return {};
118-
}
119-
120111
// clang-format off
121112
void InitializeUninstaller()
122113
{
123114
steamPath = GetSteamPath();
124-
auto millenniumLocalPath = GetMillenniumLocalPath();
115+
auto millenniumPath = steamPath / "millennium";
125116

126117
isUninstalling = false;
127118
uninstallFinished = false;
128119

129-
bool isNewLayout = !millenniumLocalPath.empty() && std::filesystem::exists(millenniumLocalPath);
120+
bool isNewLayout = std::filesystem::exists(millenniumPath);
130121

131122
std::vector<std::filesystem::path> millenniumPaths;
132123

133124
if (isNewLayout) {
134-
// New install (>2.35.0): files in %LOCALAPPDATA%/Millennium + hardlink in Steam
135125
millenniumPaths = {
136-
millenniumLocalPath / "lib",
137-
millenniumLocalPath / "bin",
126+
millenniumPath / "lib",
127+
millenniumPath / "bin",
138128
steamPath / "wsock32.dll",
139129
};
140130
} else {
@@ -156,12 +146,17 @@ void InitializeUninstaller()
156146
uninstallComponents = {
157147
{ "Millennium", std::make_tuple(ComponentState({ false, true }), MakeComponentProps(millenniumPaths)) },
158148
{ "Custom Steam Components", std::make_tuple(ComponentState({ false, true }), MakeComponentProps({
149+
millenniumPath / "ext" / "data" / "assets",
150+
millenniumPath / "ext" / "data" / "shims",
159151
steamPath / "ext" / "data" / "assets",
160152
steamPath / "ext" / "data" / "shims"
161153
})) },
162-
{ "Dependencies", std::make_tuple(ComponentState({ false, true }), MakeComponentProps({ steamPath / "ext" / "data" / "cache", steamPath / "ext" / "data" / "pyx64" })) },
163-
{ "Themes", std::make_tuple(ComponentState({ false, true }), MakeComponentProps({ steamPath / "steamui" / "skins" })) },
164-
{ "Plugins", std::make_tuple(ComponentState({ false, true }), MakeComponentProps({ steamPath / "plugins" })) },
154+
{ "Dependencies", std::make_tuple(ComponentState({ false, true }), MakeComponentProps({
155+
steamPath / "ext" / "data" / "cache",
156+
steamPath / "ext" / "data" / "pyx64"
157+
})) },
158+
{ "Themes", std::make_tuple(ComponentState({ false, true }), MakeComponentProps({ millenniumPath / "themes", steamPath / "steamui" / "skins" })) },
159+
{ "Plugins", std::make_tuple(ComponentState({ false, true }), MakeComponentProps({ millenniumPath / "plugins", steamPath / "plugins" })) },
165160
};
166161
}
167162
// clang-format on

0 commit comments

Comments
 (0)