mirror of
https://github.com/AndnixSH/APKToolGUI.git
synced 2026-05-04 11:02:27 +00:00
Temp logic
Fix freezing when clearing temp folder Standard temp location will be ...\AppData\Local\APKToolGUI\Temp\XXXXX
This commit is contained in:
@@ -1434,21 +1434,25 @@ namespace APKToolGUI
|
||||
#endregion
|
||||
|
||||
#region Form handlers
|
||||
private void clearTempFolderToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private async void clearTempFolderToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Running(Language.ClearTempFolder);
|
||||
try
|
||||
{
|
||||
foreach (var subDir in new DirectoryInfo(Program.TEMP_MAIN).EnumerateDirectories())
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.DeletingFolder, subDir));
|
||||
subDir.Delete(true);
|
||||
}
|
||||
foreach (var subDir in new DirectoryInfo(Program.TEMP_MAIN).EnumerateDirectories())
|
||||
{
|
||||
ToLog(ApktoolEventType.None, String.Format(Language.DeletingFolder, subDir));
|
||||
DirectoryUtils.Delete(subDir.FullName);
|
||||
}
|
||||
Directory.CreateDirectory(Program.TEMP_PATH);
|
||||
});
|
||||
Done();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ToLog(ApktoolEventType.Error, ex.Message);
|
||||
Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +73,11 @@ namespace APKToolGUI.Handlers
|
||||
{
|
||||
if (Directory.Exists(Program.TEMP_PATH))
|
||||
Process.Start("explorer.exe", Program.TEMP_PATH);
|
||||
else
|
||||
{
|
||||
Directory.CreateDirectory(Program.TEMP_PATH);
|
||||
Process.Start("explorer.exe", Program.TEMP_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
private void menuItemCheckUpdate_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -244,7 +244,7 @@ namespace APKToolGUI
|
||||
if (Settings.Default.UseCustomTempDir)
|
||||
return Path.Combine(Settings.Default.TempDir);
|
||||
else
|
||||
return Path.Combine(LOCAL_APPDATA_PATH, ASSEMBLY_NAME);
|
||||
return Path.Combine(LOCAL_APPDATA_PATH, ASSEMBLY_NAME, "Temp");
|
||||
}
|
||||
|
||||
public static string RandTempDirectory()
|
||||
|
||||
Reference in New Issue
Block a user