mirror of https://github.com/quasar/Quasar.git
Fix for uninstalling in admin folder
Make sure it doesn't just have the read-only attribute. If it does and we have admin. privileges, strip all of the files in the client's install path so that we can proceed and continue the uninstallation process.
This commit is contained in:
parent
6dbb5bface
commit
5dc8c0b07f
|
@ -25,6 +25,34 @@ public static void Uninstall(Client client)
|
|||
|
||||
try
|
||||
{
|
||||
DirectoryInfo dir = new DirectoryInfo(ClientData.InstallPath);
|
||||
|
||||
if (dir.Exists)
|
||||
{
|
||||
// Directory is marked as read-only, so we must remove it.
|
||||
if ((dir.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
|
||||
{
|
||||
if (WindowsAccountHelper.GetAccountType() == "Admin")
|
||||
{
|
||||
foreach (FileInfo file in dir.GetFiles())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Try to set the files in the folder to normal so they can be deleted.
|
||||
file.Attributes = FileAttributes.Normal;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We need admin privileges to strip this directory of the read-only attribute...
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string batchFile = FileHelper.CreateUninstallBatch(Settings.HIDEFILE);
|
||||
|
||||
if (string.IsNullOrEmpty(batchFile)) return;
|
||||
|
|
Loading…
Reference in New Issue