mirror of
https://github.com/FroggMaster/CreamInstaller.git
synced 2026-07-28 14:47:04 -07:00
Fix for SteamCMD Migration
- Fix for SteamCMD Migration: Creates SteamCMD directory before trying to start the download (Woops, kinda need to do that.) - Ensures the application migrates SteamCMD files fom the legacy location C:\ProgramData\Creamlnstaller\ to C:\ProgramData\Creamlnstaller\SteamCMD\
This commit is contained in:
@@ -137,9 +137,42 @@ internal static partial class SteamCMD
|
||||
}
|
||||
});
|
||||
|
||||
private static void MigrateLegacyFiles()
|
||||
{
|
||||
string oldFilePath = ProgramData.DirectoryPath + @"\steamcmd.exe";
|
||||
if (!oldFilePath.FileExists())
|
||||
return;
|
||||
DirectoryPath.CreateDirectory();
|
||||
string[] steamCmdFiles =
|
||||
[
|
||||
"steamcmd.exe", "steamcmd.exe.old", "steam.dll", "crashhandler.dll",
|
||||
"tier0_s.dll", "vstdlib_s.dll", "steamclient.dll", "steamclient64.dll",
|
||||
"steamerrorreporter.exe", "steamconsole.dll", "crashhandler64.dll",
|
||||
"vstdlib_s64.dll", "steamconsole64.dll", "tier0_s64.dll", ".crash"
|
||||
];
|
||||
string[] steamCmdDirs =
|
||||
[
|
||||
"logs", "bin", "public", "siteserverui", "package"
|
||||
];
|
||||
string oldDirectory = ProgramData.DirectoryPath;
|
||||
foreach (string file in steamCmdFiles)
|
||||
{
|
||||
string source = oldDirectory + @"\" + file;
|
||||
string dest = DirectoryPath + @"\" + file;
|
||||
source.MoveFile(dest);
|
||||
}
|
||||
foreach (string dir in steamCmdDirs)
|
||||
{
|
||||
string source = oldDirectory + @"\" + dir;
|
||||
string dest = DirectoryPath + @"\" + dir;
|
||||
source.MoveDirectory(dest);
|
||||
}
|
||||
}
|
||||
|
||||
internal static async Task<bool> Setup(IProgress<int> progress)
|
||||
{
|
||||
await Cleanup();
|
||||
MigrateLegacyFiles();
|
||||
if (!FilePath.FileExists())
|
||||
{
|
||||
bool retryDownload = true;
|
||||
|
||||
@@ -51,6 +51,7 @@ internal static class Resources
|
||||
{
|
||||
using Stream resource = Assembly.GetExecutingAssembly()
|
||||
.GetManifestResourceStream("CreamInstaller.Resources." + resourceIdentifier);
|
||||
Path.GetDirectoryName(filePath)?.CreateDirectory();
|
||||
using FileStream file = new(filePath, FileMode.Create, FileAccess.Write);
|
||||
resource?.CopyTo(file);
|
||||
break;
|
||||
@@ -68,6 +69,7 @@ internal static class Resources
|
||||
while (!Program.Canceled)
|
||||
try
|
||||
{
|
||||
Path.GetDirectoryName(filePath)?.CreateDirectory();
|
||||
using FileStream fileStream = new(filePath, FileMode.Create, FileAccess.Write);
|
||||
fileStream.Write(resource);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user