mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Address "Access to the path is denied" error
This commit is contained in:
parent
ff387cfc59
commit
3f0ab22393
@ -57,21 +57,13 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
private static bool _showingExceptionDialog = false;
|
private static bool _showingExceptionDialog = false;
|
||||||
|
|
||||||
private static bool _terminating = false;
|
|
||||||
|
|
||||||
public static void Terminate(ErrorCode exitCode = ErrorCode.ERROR_SUCCESS)
|
public static void Terminate(ErrorCode exitCode = ErrorCode.ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
if (_terminating)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int exitCodeNum = (int)exitCode;
|
int exitCodeNum = (int)exitCode;
|
||||||
|
|
||||||
Logger.WriteLine("App::Terminate", $"Terminating with exit code {exitCodeNum} ({exitCode})");
|
Logger.WriteLine("App::Terminate", $"Terminating with exit code {exitCodeNum} ({exitCode})");
|
||||||
|
|
||||||
Current.Dispatcher.Invoke(() => Current.Shutdown(exitCodeNum));
|
Environment.Exit(exitCodeNum);
|
||||||
// Environment.Exit(exitCodeNum);
|
|
||||||
|
|
||||||
_terminating = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalExceptionHandler(object sender, DispatcherUnhandledExceptionEventArgs e)
|
void GlobalExceptionHandler(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||||
@ -109,6 +101,7 @@ namespace Bloxstrap
|
|||||||
public static async Task<GithubRelease?> GetLatestRelease()
|
public static async Task<GithubRelease?> GetLatestRelease()
|
||||||
{
|
{
|
||||||
const string LOG_IDENT = "App::GetLatestRelease";
|
const string LOG_IDENT = "App::GetLatestRelease";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var releaseInfo = await Http.GetJson<GithubRelease>($"https://api.github.com/repos/{ProjectRepository}/releases/latest");
|
var releaseInfo = await Http.GetJson<GithubRelease>($"https://api.github.com/repos/{ProjectRepository}/releases/latest");
|
||||||
|
@ -35,8 +35,20 @@ namespace Bloxstrap
|
|||||||
if (!IsImplicitInstall)
|
if (!IsImplicitInstall)
|
||||||
{
|
{
|
||||||
Filesystem.AssertReadOnly(Paths.Application);
|
Filesystem.AssertReadOnly(Paths.Application);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
File.Copy(Paths.Process, Paths.Application, true);
|
File.Copy(Paths.Process, Paths.Application, true);
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Could not overwrite executable");
|
||||||
|
App.Logger.WriteException(LOG_IDENT, ex);
|
||||||
|
|
||||||
|
Frontend.ShowMessageBox(Strings.Installer_Install_CannotOverwrite, MessageBoxImage.Error);
|
||||||
|
App.Terminate(ErrorCode.ERROR_INSTALL_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: registry access checks, i'll need to look back on issues to see what the error looks like
|
// TODO: registry access checks, i'll need to look back on issues to see what the error looks like
|
||||||
using (var uninstallKey = Registry.CurrentUser.CreateSubKey(App.UninstallKey))
|
using (var uninstallKey = Registry.CurrentUser.CreateSubKey(App.UninstallKey))
|
||||||
@ -259,8 +271,10 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
() => File.Delete(StartMenuShortcut),
|
() => File.Delete(StartMenuShortcut),
|
||||||
|
|
||||||
() => Directory.Delete(Paths.Versions, true),
|
|
||||||
() => Directory.Delete(Paths.Downloads, true),
|
() => Directory.Delete(Paths.Downloads, true),
|
||||||
|
() => Directory.Delete(Paths.Roblox, true),
|
||||||
|
|
||||||
|
() => File.Delete(App.State.FileLocation)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!keepData)
|
if (!keepData)
|
||||||
@ -270,8 +284,7 @@ namespace Bloxstrap
|
|||||||
() => Directory.Delete(Paths.Modifications, true),
|
() => Directory.Delete(Paths.Modifications, true),
|
||||||
() => Directory.Delete(Paths.Logs, true),
|
() => Directory.Delete(Paths.Logs, true),
|
||||||
|
|
||||||
() => File.Delete(App.Settings.FileLocation),
|
() => File.Delete(App.Settings.FileLocation)
|
||||||
() => File.Delete(App.State.FileLocation), // TODO: maybe this should always be deleted? not sure yet
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -525,6 +538,8 @@ namespace Bloxstrap
|
|||||||
}
|
}
|
||||||
|
|
||||||
App.FastFlags.SetValue("FFlagFixGraphicsQuality", null);
|
App.FastFlags.SetValue("FFlagFixGraphicsQuality", null);
|
||||||
|
|
||||||
|
Directory.Delete(Path.Combine(Paths.Base, "Versions"));
|
||||||
}
|
}
|
||||||
|
|
||||||
App.Settings.Save();
|
App.Settings.Save();
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
public static string Downloads { get; private set; } = "";
|
public static string Downloads { get; private set; } = "";
|
||||||
public static string Logs { get; private set; } = "";
|
public static string Logs { get; private set; } = "";
|
||||||
public static string Integrations { get; private set; } = "";
|
public static string Integrations { get; private set; } = "";
|
||||||
public static string Versions { get; private set; } = "";
|
|
||||||
public static string Modifications { get; private set; } = "";
|
public static string Modifications { get; private set; } = "";
|
||||||
public static string Roblox { get; private set; } = "";
|
public static string Roblox { get; private set; } = "";
|
||||||
|
|
||||||
@ -36,7 +35,6 @@
|
|||||||
Downloads = Path.Combine(Base, "Downloads");
|
Downloads = Path.Combine(Base, "Downloads");
|
||||||
Logs = Path.Combine(Base, "Logs");
|
Logs = Path.Combine(Base, "Logs");
|
||||||
Integrations = Path.Combine(Base, "Integrations");
|
Integrations = Path.Combine(Base, "Integrations");
|
||||||
Versions = Path.Combine(Base, "Versions");
|
|
||||||
Modifications = Path.Combine(Base, "Modifications");
|
Modifications = Path.Combine(Base, "Modifications");
|
||||||
Roblox = Path.Combine(Base, "Roblox");
|
Roblox = Path.Combine(Base, "Roblox");
|
||||||
|
|
||||||
|
11
Bloxstrap/Resources/Strings.Designer.cs
generated
11
Bloxstrap/Resources/Strings.Designer.cs
generated
@ -1446,6 +1446,17 @@ namespace Bloxstrap.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Bloxstrap has been installed to this location before and is still present, however the installer cannot overwrite the old executable.
|
||||||
|
///
|
||||||
|
///Please manually delete Bloxstrap.exe from the install location or try restarting your system, and then retry installation afterwards..
|
||||||
|
/// </summary>
|
||||||
|
public static string Installer_Install_CannotOverwrite {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Installer.Install.CannotOverwrite", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Existing data found. Your mods and settings will be restored..
|
/// Looks up a localized string similar to Existing data found. Your mods and settings will be restored..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1177,4 +1177,9 @@ Are you sure you want to continue?</value>
|
|||||||
<data name="Dialog.Connectivity.RobloxUpgradeNeeded" xml:space="preserve">
|
<data name="Dialog.Connectivity.RobloxUpgradeNeeded" xml:space="preserve">
|
||||||
<value>Because Roblox needs to be installed or upgraded, Bloxstrap cannot continue.</value>
|
<value>Because Roblox needs to be installed or upgraded, Bloxstrap cannot continue.</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Installer.Install.CannotOverwrite" xml:space="preserve">
|
||||||
|
<value>Bloxstrap has been installed to this location before and is still present, however the installer cannot overwrite the old executable.
|
||||||
|
|
||||||
|
Please manually delete Bloxstrap.exe from the install location or try restarting your system, and then retry installation afterwards.</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@ -2,12 +2,6 @@
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
|
||||||
using Bloxstrap.Resources;
|
|
||||||
|
|
||||||
using Microsoft.Win32;
|
|
||||||
using Wpf.Ui.Mvvm.Interfaces;
|
|
||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
namespace Bloxstrap.UI.ViewModels.Installer
|
namespace Bloxstrap.UI.ViewModels.Installer
|
||||||
{
|
{
|
||||||
public class InstallViewModel : NotifyPropertyChangedViewModel
|
public class InstallViewModel : NotifyPropertyChangedViewModel
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Security.Principal;
|
|
||||||
|
|
||||||
namespace Bloxstrap
|
namespace Bloxstrap
|
||||||
{
|
{
|
||||||
@ -52,9 +51,9 @@ namespace Bloxstrap
|
|||||||
public static string GetRobloxVersion(bool studio)
|
public static string GetRobloxVersion(bool studio)
|
||||||
{
|
{
|
||||||
string versionGuid = studio ? App.State.Prop.Studio.VersionGuid : App.State.Prop.Player.VersionGuid;
|
string versionGuid = studio ? App.State.Prop.Studio.VersionGuid : App.State.Prop.Player.VersionGuid;
|
||||||
string fileName = studio ? "RobloxStudioBeta.exe" : "RobloxPlayerBeta.exe";
|
string fileName = studio ? "Studio/RobloxStudioBeta.exe" : "Player/RobloxPlayerBeta.exe";
|
||||||
|
|
||||||
string playerLocation = Path.Combine(Paths.Versions, versionGuid, fileName);
|
string playerLocation = Path.Combine(Paths.Roblox, fileName);
|
||||||
|
|
||||||
if (!File.Exists(playerLocation))
|
if (!File.Exists(playerLocation))
|
||||||
return "";
|
return "";
|
||||||
|
Loading…
Reference in New Issue
Block a user