[core] move downloads from <app_location>\rufus_files\ to %LOCALAPPDATA%\Rufus\

* While this is intended to solve the issue of saving GRUB/Syslinux files for the
  App Store version, we apply this change globally, as it allows the user to move
  the Rufus executable around while preserving access to existing downloads.
* Closes #1744
This commit is contained in:
Pete Batard 2021-05-31 16:54:11 +01:00
parent aeae66e971
commit 9d7e96e293
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
10 changed files with 47 additions and 28 deletions

View file

@ -6,7 +6,7 @@
*
* See also: https://utf8everywhere.org
*
* Copyright © 2010-2020 Pete Batard <pete@akeo.ie>
* Copyright © 2010-2021 Pete Batard <pete@akeo.ie>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -642,6 +642,19 @@ static __inline UINT GetSystemWindowsDirectoryU(char* lpBuffer, UINT uSize)
return ret;
}
static __inline BOOL SHGetSpecialFolderPathU(HWND hwnd, char* pszPath, int csidl, BOOL fCreate)
{
BOOL ret;
DWORD err = ERROR_INVALID_DATA;
// pszPath is at least MAX_PATH characters in size
WCHAR wpszPath[MAX_PATH] = { 0 };
ret = SHGetSpecialFolderPathW(hwnd, wpszPath, csidl, fCreate);
err = GetLastError();
wchar_to_utf8_no_alloc(wpszPath, pszPath, MAX_PATH);
SetLastError(err);
return ret;
}
static __inline DWORD GetTempPathU(DWORD nBufferLength, char* lpBuffer)
{
DWORD ret = 0, err = ERROR_INVALID_DATA;