-
Notifications
You must be signed in to change notification settings - Fork 765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access deni when autoupdate and unzip #639
Comments
It is possible to change file attributes and replace files if the user running the app have proper permissions. It is possible that WinRAR does the same. I will look into it and let you know. Thanks for reporting it. |
If you have solution, please let me know. |
Right now, you can remove the read Only attribute in Application Exit event as shown below. AutoUpdater.ApplicationExitEvent += AutoUpdater_ApplicationExitEvent;
private void AutoUpdater_ApplicationExitEvent()
{
string currentDirectory = AppDomain.CurrentDomain.BaseDirectory;
RemoveReadOnlyAttribute(currentDirectory);
}
private void RemoveReadOnlyAttribute(string directoryPath)
{
// Remove readonly attribute from files in the current directory
string[] files = Directory.GetFiles(directoryPath);
foreach (string file in files)
{
FileAttributes attributes = File.GetAttributes(file);
if ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
{
File.SetAttributes(file, attributes & ~FileAttributes.ReadOnly);
}
}
// Recursively remove readonly attribute from subdirectories
string[] subdirectories = Directory.GetDirectories(directoryPath);
foreach (string subdirectory in subdirectories)
{
RemoveReadOnlyAttribute(subdirectory);
}
} |
Ok thank you, i will try it! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After download update file (zip), it cannot run unzip
https://i.imgur.com/QUL9Ydq.png
Some files on this folder (htkk) is Read-only, however overwrite it?
(if i manual download and using winrar to extract same folder, it's ok).
Thank you!
The text was updated successfully, but these errors were encountered: