mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 06:22:20 +00:00
reverting to the old way to get windows directories since the function I am using does not work on windows systems without IE4. a=nhotta@netscape.com
This commit is contained in:
parent
13a03e0325
commit
8b43f9100e
@ -174,23 +174,43 @@ static char* MakeUpperCase(char* aPath)
|
|||||||
static void GetWindowsFolder(int folder, nsFileSpec& outDirectory)
|
static void GetWindowsFolder(int folder, nsFileSpec& outDirectory)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
TCHAR path[MAX_PATH+1];
|
LPMALLOC pMalloc = NULL;
|
||||||
HRESULT result = SHGetSpecialFolderPath(NULL, path, folder, true);
|
LPSTR pBuffer = NULL;
|
||||||
|
LPITEMIDLIST pItemIDList = NULL;
|
||||||
if (!SUCCEEDED(result))
|
int len;
|
||||||
|
|
||||||
|
// Get the shell's allocator.
|
||||||
|
if (!SUCCEEDED(SHGetMalloc(&pMalloc)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Allocate a buffer
|
||||||
|
if ((pBuffer = (LPSTR) pMalloc->Alloc(MAX_PATH + 2)) == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Get the PIDL for the folder.
|
||||||
|
if (!SUCCEEDED(SHGetSpecialFolderLocation(
|
||||||
|
NULL, folder, &pItemIDList)))
|
||||||
|
goto Clean;
|
||||||
|
|
||||||
|
if (!SUCCEEDED(SHGetPathFromIDList(pItemIDList, pBuffer)))
|
||||||
|
goto Clean;
|
||||||
|
|
||||||
// Append the trailing slash
|
// Append the trailing slash
|
||||||
int len = PL_strlen(path);
|
len = PL_strlen(pBuffer);
|
||||||
if (len>1 && path[len-1] != '\\')
|
pBuffer[len] = '\\';
|
||||||
{
|
pBuffer[len + 1] = '\0';
|
||||||
path[len] = '\\';
|
|
||||||
path[len + 1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assign the directory
|
// Assign the directory
|
||||||
outDirectory = path;
|
outDirectory = pBuffer;
|
||||||
|
|
||||||
|
Clean:
|
||||||
|
// Clean up.
|
||||||
|
if (pItemIDList)
|
||||||
|
pMalloc->Free(pItemIDList);
|
||||||
|
if (pBuffer)
|
||||||
|
pMalloc->Free(pBuffer);
|
||||||
|
|
||||||
|
pMalloc->Release();
|
||||||
} // GetWindowsFolder
|
} // GetWindowsFolder
|
||||||
#endif // XP_WIN
|
#endif // XP_WIN
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user