mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 18:35:41 +00:00
Use a default path if there are no settings
svn path=/trunk/; revision=30740
This commit is contained in:
parent
fb7fa3afaf
commit
1b3dd9fe0e
1 changed files with 32 additions and 12 deletions
|
@ -229,30 +229,50 @@ ThreadFunc(LPVOID Context)
|
||||||
BOOL bCancelled = FALSE;
|
BOOL bCancelled = FALSE;
|
||||||
BOOL bTempfile = FALSE;
|
BOOL bTempfile = FALSE;
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
|
DWORD dwSize = MAX_PATH;
|
||||||
|
|
||||||
/* built the path for the download */
|
/* built the path for the download */
|
||||||
p = wcsrchr(SelectedApplication->Location, L'/');
|
p = wcsrchr(SelectedApplication->Location, L'/');
|
||||||
if (NULL == p)
|
if (NULL == p)
|
||||||
{
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if (RegOpenKey(HKEY_LOCAL_MACHINE,
|
|
||||||
TEXT("Software\\ReactOS\\Downloader"),
|
|
||||||
&hKey) != ERROR_SUCCESS)
|
|
||||||
{
|
{
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD dwSize = MAX_PATH;
|
/* Create default download path */
|
||||||
if (RegQueryValueEx(hKey,
|
if (GetWindowsDirectory(path, sizeof(path) / sizeof(WCHAR)))
|
||||||
|
{
|
||||||
|
WCHAR DPath[256];
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
if (i == 3)
|
||||||
|
{
|
||||||
|
DPath[i] = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DPath[i] = path[i];
|
||||||
|
}
|
||||||
|
LoadString(GetModuleHandle(NULL), IDS_DOWNLOAD_FOLDER, path, sizeof(path) / sizeof(WCHAR));
|
||||||
|
wcscat((LPWSTR)DPath, path);
|
||||||
|
wcscpy(path, DPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RegOpenKey(HKEY_LOCAL_MACHINE,
|
||||||
|
TEXT("Software\\ReactOS\\Downloader"),
|
||||||
|
&hKey) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
if ((RegQueryValueEx(hKey,
|
||||||
L"DownloadFolder",
|
L"DownloadFolder",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(LPBYTE)&path,
|
(LPBYTE)&path,
|
||||||
&dwSize) != ERROR_SUCCESS)
|
&dwSize) != ERROR_SUCCESS) && (path[0] == 0))
|
||||||
{
|
{
|
||||||
goto end;
|
goto end;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (GetFileAttributes(path) == 0xFFFFFFFF)
|
if (GetFileAttributes(path) == 0xFFFFFFFF)
|
||||||
if (!CreateDirectory((LPCTSTR)path,NULL))
|
if (!CreateDirectory((LPCTSTR)path,NULL))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue