M2Team / NanaGet

Lightweight file transfer utility based on aria2 and XAML Islands
https://www.microsoft.com/store/apps/9PD5F2D90LS5
Other
127 stars 10 forks source link

Messy code when clicking 'Open Downloads Folder' #1

Closed AndromedaMelody closed 2 years ago

AndromedaMelody commented 2 years ago

APP Version: NanaGet 1.0 (1.0.36.0) System Version: Windows 11 22H1 (22621.1) System Language: English

Screenshot 2022-06-01 235744

MouriNaruto commented 2 years ago

I will keep track of this issue and try my best to reproduce it.

P.S. I can't reproduce this issue on my device at current.

Kenji Mouri

AndromedaMelody commented 2 years ago

Today, I clicked 'Open Downloads Folder', and then the area of Xaml Islands was turned into black, finally it exited due to exception.

hl2guide commented 2 years ago

I will keep track of this issue and try my best to reproduce it.

P.S. I can't reproduce this issue on my device at current.

Kenji Mouri

Screenshot 2022-07-31 054525

Seems like the download folder is incorrectly set (Japanese?) instead of localized to PC.

I'm using Windows 11 21H2.

driver1998 commented 2 years ago

On my machine, open downloads folder sometimes jumps to c:\windows\system32 instead of the downloads folder. 19044.1889 here.

MouriNaruto commented 2 years ago

It looks not the occasionally cases, I will try to fix them by guessing the possible reasons because I can't reproduce.

I will rewrite some implementations in NanaGet because I met some strange application crashes.

Kenji Mouri

driver1998 commented 2 years ago

Looks like the std::filesystem::path returned from NanaGet::GetDownloadsFolderPath got destructed after c_str().

Seems to work fine now if I store the object to a variable.

diff --git a/NanaGet/MainPage.cpp b/NanaGet/MainPage.cpp
index 8a0a077..bab34cc 100644
--- a/NanaGet/MainPage.cpp
+++ b/NanaGet/MainPage.cpp
@@ -112,11 +112,13 @@ namespace winrt::NanaGet::implementation
     {
         UNREFERENCED_PARAMETER(sender);
         UNREFERENCED_PARAMETER(e);
+
+        std::filesystem::path downloadsFolderPath = NanaGet::GetDownloadsFolderPath();

         SHELLEXECUTEINFOW ExecInfo = { 0 };
         ExecInfo.cbSize = sizeof(SHELLEXECUTEINFOW);
         ExecInfo.lpVerb = L"open";
-        ExecInfo.lpFile = NanaGet::GetDownloadsFolderPath().c_str();
+        ExecInfo.lpFile = downloadsFolderPath.c_str();
         ExecInfo.nShow = SW_SHOWNORMAL;
         ::ShellExecuteExW(&ExecInfo);
     }
MouriNaruto commented 2 years ago

@driver1998

Thank you. I have merged it just now.

Kenji Mouri