- From: Stanimir Stamenkov <stanio@myrealbox.com>
- Date: Sun, 30 Apr 2006 14:24:09 +0300
- To: www-amaya@w3.org
- Message-ID: <44549E59.60008@myrealbox.com>
/Stanimir Stamenkov/: > I've pointed this problem even before: > > http://lists.w3.org/Archives/Public/www-amaya/2004JanMar/0031.html > http://lists.w3.org/Archives/Public/www-amaya/2005JulSep/0047 I'm attaching a small example for the proper identification of the Amaya profile directory under Windows. -- Stanimir
#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
#include <shlobj.h>
#define AMAYA_DIR_NAME _T("amaya")
int _tmain(int argc, _TCHAR* argv[])
{
DWORD errorCode;
TCHAR amayaDirPath[MAX_PATH];
if (SHGetFolderPathAndSubDir(NULL, CSIDL_APPDATA, NULL,
SHGFP_TYPE_CURRENT, AMAYA_DIR_NAME, amayaDirPath) != S_OK)
{
_tprintf(_T("Error (1)\r\n"));
return 1;
}
if (CreateDirectory(amayaDirPath, NULL))
{
_tprintf(_T("\"%s\" directory created.\r\n"), amayaDirPath);
}
else
{
errorCode = GetLastError();
if (errorCode != ERROR_ALREADY_EXISTS)
{
_tprintf(_T("Error: %d\r\n"), errorCode);
return 2;
}
_tprintf(_T("\"%s\" directory already exists.\r\n"), amayaDirPath);
}
return 0;
}
Received on Sunday, 30 April 2006 11:24:23 UTC