本文整理汇总了C++中PathAppend函数的典型用法代码示例。如果您正苦于以下问题:C++ PathAppend函数的具体用法?C++ PathAppend怎么用?C++ PathAppend使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PathAppend函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDefaultAspellPath
void GetDefaultAspellPath (TCHAR *&Path)
{
TCHAR pszPath[MAX_PATH];
pszPath[0] = '\0';
HKEY hKey = NULL;
DWORD size = MAX_PATH;
if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T ("SOFTWARE\\Aspell"), 0, KEY_READ, &hKey))
{
if (ERROR_SUCCESS == ::RegQueryValueEx(hKey, _T ("Path"), NULL ,NULL, (LPBYTE)pszPath, &size))
wcscat(pszPath, _T ("\\aspell-15.dll"));
::RegCloseKey(hKey);
}
else
{
TCHAR Pf[MAX_PATH];
SHGetSpecialFolderPath(
0,
Pf,
CSIDL_PROGRAM_FILES,
FALSE );
PathAppend(pszPath, Pf);
PathAppend(pszPath, _T("\\Aspell\\bin\\aspell-15.dll"));
}
SetString (Path, pszPath);
}
示例2: SHGetFolderPath
void CEyepatch::LoadCreateModeClassifiers() {
WCHAR rootpath[MAX_PATH];
WCHAR searchpath[MAX_PATH];
WCHAR fullpath[MAX_PATH];
SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, rootpath);
PathAppend(rootpath, APP_CLASS);
wcscpy(searchpath,rootpath);
PathAppend(searchpath, L"*.*");
HANDLE hFind;
WIN32_FIND_DATA win32fd;
if ((hFind = FindFirstFile(searchpath, &win32fd)) == INVALID_HANDLE_VALUE) {
return;
}
do {
if (win32fd.cFileName[0] != '.' &&
(win32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
!(win32fd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)) {
wcscpy(fullpath, rootpath);
PathAppend(fullpath, win32fd.cFileName);
m_videoMarkup.LoadClassifier(fullpath);
}
} while(FindNextFile(hFind, &win32fd) != 0);
FindClose(hFind);
}
示例3: AddDxccDllPath
bool AddDxccDllPath(CStringA& ErrorMsg)
{
ErrorMsg= "No Errors";
#define DXCC_PATH TEXT("..\\..\\..\\..\\x86\\")
#define DXCC_FILE TEXT("DXCC.DLL")
HMODULE hMLL = GetModuleHandle(TEXT(THISFILENAME));
TCHAR mllPath[MAX_PATH];
DWORD mllPathLen = GetModuleFileName(hMLL, mllPath, MAX_PATH);
if (!(mllPathLen != 0 && mllPathLen < MAX_PATH))
{
ErrorMsg= "Could not fetch this module's filename and length.";
return false;
}
TCHAR fullPath[MAX_PATH];
TCHAR* fileName;
DWORD fullPathLen = GetFullPathName(mllPath, MAX_PATH, fullPath, &fileName);
if (!(fullPathLen != 0 && fullPathLen < MAX_PATH && fileName))
{
ErrorMsg= "Could not fetch the full path of this module.";
return false;
}
fileName[0] = 0; // lop off file name from path
//no need to add the current path at this time
//we dont want local overrides at this time
//PrependPathToEnv(fullPath);
PathAppend(fullPath, DXCC_PATH);
PrependPathToEnv(fullPath);
HMODULE hDXCC = LoadLibrary(DXCC_FILE);
if(hDXCC == NULL)
{
ErrorMsg="DXCC.DLL could not be found";
return false;
}
PathAppend(fullPath, DXCC_FILE);
TCHAR dxccPath[MAX_PATH];
DWORD dxccPathLen = GetModuleFileName(hDXCC, dxccPath, MAX_PATH);
if( 0 != lstrcmpi( fullPath , dxccPath ) )
{
ErrorMsg.Format( "Incompatable DXCC.DLL was loaded: %S\nDesired DXCC.DLL is in path: %S", dxccPath, fullPath);
return false;
}
ErrorMsg= "No Errors";
return true;
}
示例4: GetKeyBoard
LPCTSTR GetKeyBoard(UINT Index, TCHAR * szKBPath){
TCHAR szINI[MAX_PATH];
TCHAR szKBNames[500];
TCHAR szKBFile[MAX_PATH];
TCHAR szAllUser[MAX_PATH];
TCHAR szKBP[] = TEXT("KeyBoardPaths");
lstrcpy(szINI,szDir);
PathAppend(szINI, TEXT("KeyMagic.ini"));
GetPrivateProfileString(szKBP, NULL, NULL, (LPTSTR)szKBNames, 500, szINI);
for (int i=0,Length = lstrlen(&szKBNames[i]),j=0;
j <= Index;
i+=Length+1, j++, Length = lstrlen(&szKBNames[i])){
GetPrivateProfileString(szKBP, (LPCTSTR)&szKBNames[i], NULL, (LPTSTR)szKBFile, MAX_PATH, szINI);
}
if (szKBFile[1] == ':'){
lstrcpy(szKBPath, szKBFile);
return szKBPath;
}
lstrcpy(szKBPath, szDir);
PathAppend(szKBPath, szKBFile);
return szKBPath;
}
示例5: GetCompleteLogFileName
/**
* @brief Create complete log file name.
* @param pszCompleteLogFileName - output complete file name.
* @param pszLogFileName - base log file name.
* @param pszDefFileExtension - default extension.
* @return true if log file name was created and false otherwise.
*/
BOOL GetCompleteLogFileName(PTSTR pszCompleteLogFileName, PCTSTR pszLogFileName, PCTSTR pszDefFileExtension)
{
if (pszLogFileName && *pszLogFileName && PathIsRoot(pszLogFileName))
{
_tcscpy_s(pszCompleteLogFileName, MAX_PATH, pszLogFileName);
return TRUE;
}
TCHAR szAppDataPath[MAX_PATH];
if (! SHGetSpecialFolderPath(NULL, szAppDataPath, CSIDL_APPDATA, TRUE))
return FALSE;
TCHAR szAppName[MAX_PATH];
if (! GetCanonicalAppName(szAppName, countof(szAppName), TRUE))
return FALSE;
TCHAR szAppFileName[MAX_PATH];
if (! GetModuleFileName(NULL, szAppFileName, countof(szAppFileName)))
return FALSE;
PTSTR pszFileName = PathFindFileName(szAppFileName);
PathRemoveExtension(pszFileName);
PTSTR pszAppName = *szAppName ? szAppName : pszFileName;
PathCombine(pszCompleteLogFileName, szAppDataPath, pszAppName);
if (pszLogFileName == NULL || *pszLogFileName == _T('\0'))
{
if (pszDefFileExtension == NULL || *pszDefFileExtension != _T('.'))
return FALSE;
PathAppend(pszCompleteLogFileName, pszFileName);
PathAddExtension(pszCompleteLogFileName, pszDefFileExtension);
}
else
PathAppend(pszCompleteLogFileName, pszLogFileName);
return TRUE;
}
示例6: settings_path
static std::string settings_path(bool *firsttime)
{
TCHAR szPath[MAX_PATH];
if(SUCCEEDED(SHGetFolderPath(NULL,
CSIDL_APPDATA,
NULL,
0,
szPath)))
{
FILE *f;
PathAppend(szPath,TEXT("vrok"));
CreateDirectory(szPath,NULL);
PathAppend(szPath,TEXT("vrok.conf"));
f=_wfopen(szPath,TEXT("r"));
DBG(szPath);
if (!f) {
*firsttime = true;
} else {
*firsttime = false;
fclose(f);
}
char upath[1024];
WideCharToMultiByte(CP_UTF8,0,szPath,-1,upath,1024,0,NULL);
return std::string(upath);
} else {
DBG("Can't get settings path, exiting");
exit(-1);
}
}
示例7: spool_instance_isAlive
BOOL spool_instance_isAlive(P_SPOOL spool, int instance) {
TCHAR path[MAX_PATH];
TCHAR instance_str[32];
snprintf(instance_str, sizeof(instance_str), "%d", instance);
snprintf(path, sizeof(path), "%s", spool->path);
if (PathAppend(path, SPOOL_DIR_INSTANCE) == FALSE) {
fprintf(stderr, "PathAppend error\n");
return FALSE;
}
if (PathAppend(path, instance_str) == FALSE) {
fprintf(stderr, "PathAppend error\n");
return FALSE;
}
if (! PathFileExists(path)) {
snprintf(instance_str, sizeof(instance_str), "%d", instance);
snprintf(path, sizeof(path), "%s", spool->path);
if (PathAppend(path, SPOOL_DIR_TOSTART) == FALSE) {
fprintf(stderr, "PathAppend error\n");
return FALSE;
}
if (PathAppend(path, instance_str) == FALSE) {
fprintf(stderr, "PathAppend error\n");
return FALSE;
}
return PathFileExists(path);
}
return TRUE;
}
示例8: spool_instance_create
int spool_instance_create(P_SPOOL spool, const LPSTR appId, const LPSTR args) {
int instance;
TCHAR path[MAX_PATH];
TCHAR instance_str[32];
FILE *f = NULL;
instance = spool_build_unique_id(spool);
snprintf(instance_str, sizeof(instance_str), "%d", instance);
snprintf(path, sizeof(path), "%s", spool->path);
if (PathAppend(path, SPOOL_DIR_TOSTART) == FALSE) {
fprintf(stderr, "PathAppend error\n");
return -1;
}
if (PathAppend(path, instance_str) == FALSE) {
fprintf(stderr, "PathAppend error\n");
return -1;
}
f = fopen(path, "w");
if (! f)
return -1;
fprintf(f, "id = %s", appId);
if (args != NULL && strlen(args) > 0) {
fprintf(f, "\narg = %s", args);
}
fclose(f);
return instance;
}
示例9: LoadRainmeterLibrary
/*
** Attempts to load Rainmeter.dll. If it fails, retries after loading our own copies of the CRT
** DLLs in the Runtime directory.
*/
HINSTANCE LoadRainmeterLibrary()
{
HINSTANCE rmDll = LoadLibrary(L"Rainmeter.dll");
if (!rmDll)
{
WCHAR path[MAX_PATH];
if (GetModuleFileName(nullptr, path, MAX_PATH) > 0)
{
PathRemoveFileSpec(path);
PathAppend(path, L"Runtime");
SetDllDirectory(path);
PathAppend(path, L"msvcp120.dll");
// Loading msvcpNNN.dll will load msvcrNNN.dll as well.
HINSTANCE msvcrDll = LoadLibrary(path);
SetDllDirectory(L"");
if (msvcrDll)
{
rmDll = LoadLibrary(L"Rainmeter.dll");
FreeLibrary(msvcrDll);
}
}
}
return rmDll;
}
示例10: RemoveAll
//-----------------------------------------------------------------------------
// ストレスファイルの削除
//-----------------------------------------------------------------------------
void RemoveAll(LPCTSTR path) {
WIN32_FIND_DATA data;
TCHAR wc[MAX_PATH];
PathAppend(lstrcpy(wc, path), _T("*.*"));
HANDLE hFind = FindFirstFile(wc, &data);
if (hFind == INVALID_HANDLE_VALUE) {
return;
}
do {
if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
TCHAR fname[MAX_PATH];
PathAppend(lstrcpy(fname, path), data.cFileName);
_tprintf(_T("削除 '%s' ... "), fname);
if (DeleteFile(fname)) {
_tprintf(_T("done\n"));
} else {
_tprintf(_T("error %d\n"), GetLastError());
}
}
} while (FindNextFile(hFind, &data));
FindClose(hFind);
}
示例11: TEXT
BOOL CSpecialApp::ScanXunleiSearch(int iType)
{
KSearchSoftwareStruct sss;
std::vector<std::wstring>::iterator it;
WCHAR szPath[MAX_PATH] = {0};
sss.pszMainFileName = TEXT( "Program\\thunder.exe" );
sss.hRegRootKey = HKEY_LOCAL_MACHINE;
sss.pszRegSubKey = TEXT( "SOFTWARE\\Thunder Network\\ThunderOem\\thunder_backwnd" );
sss.pszPathValue = TEXT( "dir" );
sss.bFolder = TRUE;
BOOL bRet = FALSE;
std::wstring str;
std::wstring strPath;
std::wstring strTemp;
bRet = SearchSoftwarePath( &sss, strPath);
wcscpy_s(szPath, MAX_PATH - 1, strPath.c_str());
PathRemoveFileSpec(szPath);
PathRemoveFileSpec(szPath);
PathAppend(szPath, L"Profiles\\GougouSearch\\history.history");
strPath = szPath;
if (GetFileAttributes(strPath.c_str()) == INVALID_FILE_ATTRIBUTES)
{
WCHAR* pEnv = NULL;
WCHAR szPath[MAX_PATH] = {0};
pEnv = _wgetenv(_T("public"));
if (pEnv != NULL)
{
wcscpy(szPath, pEnv);
PathAppend(szPath, L"Documents\\Thunder Network\\Thunder\\Profiles\\GougouSearch\\history.history");
strPath = szPath;
}
else
{
return TRUE;
}
}
g_fnScanFile(g_pMain, BEGINPROC(XUNLEI7_DOWNLOADER), 0, 0, 0);
for (it = g_listProcessName.begin(); it != g_listProcessName.end(); it++ )
{
str = *it;
transform(str.begin(), str.end(), str.begin(), towlower);
if (str == L"thunder.exe")
{
str = L"正在运行,跳过";
goto clean0;
}
}
str = L"";
if (m_bScan)
{
ModifyTxtData(iType, strPath.c_str());
// m_appHistory.CommfunFile(KUWOMUSIC_PLAYER, strPath.c_str(), vec_file);
}
clean0:
g_fnScanFile(g_pMain, ENDPROC(XUNLEI7_DOWNLOADER), str.c_str(), 0, 0);
return TRUE;
}
示例12: PathAppend
CString &CompletePathWithModulePath(CString &strPath, LPCTSTR lpszFilename)
{
TCHAR szPath[MAX_PATH] = {0};
::GetModuleFileName( (HMODULE)&__ImageBase, szPath, MAX_PATH);
PathAppend(szPath, _T("..\\"));
PathAppend(szPath, lpszFilename);
strPath = szPath;
return strPath;
}
示例13: SHGetSpecialFolderPath
BOOL CKSogoClean::ScanSogoAdvForm()
{
if (!_CheckSogouExist())
{
g_vsNoinstallapp.Add(SOGO_ADVFORM);
return TRUE;
}
BOOL bRet = FALSE;
WCHAR szSogoAppPath[MAX_PATH] = {0};
std::wstring strTemp;
SHGetSpecialFolderPath(NULL, szSogoAppPath, CSIDL_APPDATA, FALSE);
PathAppend(szSogoAppPath, L"SogouExplorer");
strTemp = szSogoAppPath;
PathAppend(szSogoAppPath, L"FormData.dat");
g_fnScanFile(g_pMain,BEGINPROC(SOGO_ADVFORM),0,0,0);
std::wstring str;
std::vector<std::wstring>::iterator it;
for (it = g_listProcessName.begin(); it != g_listProcessName.end(); it++ )
{
str = *it;
transform(str.begin(), str.end(), str.begin(), towlower);
if (str == L"sogouexplorer.exe")
{
str = L"正在运行,跳过";
goto clean0;
}
}
str = L"";
if (m_bScan)
{
ScanDbTable(szSogoAppPath, L"IndexPrecise", SOGO_ADVFORM);
ScanDbTable(szSogoAppPath, L"PreciseData", SOGO_ADVFORM);
std::vector<std::wstring> vec_userInfo;
std::vector<std::wstring>::iterator it;
if (GetUserInfo(vec_userInfo))
{
for (it = vec_userInfo.begin(); it != vec_userInfo.end(); it++)
{
std::wstring strUserPath;
strUserPath = strTemp;
strUserPath += L"\\";
strUserPath += *it;
strUserPath += L"\\FormData.dat";
ScanDbTable(strUserPath, L"IndexPrecise", SOGO_ADVFORM);
ScanDbTable(strUserPath, L"PreciseData", SOGO_ADVFORM);
}
}
}
clean0:
g_fnScanFile(g_pMain,ENDPROC(SOGO_ADVFORM),str.c_str(),0,0);
return bRet;
}
示例14: GetPiUserDir
std::string GetPiUserDir(const std::string &subdir)
{
// i think this test only works with glibc...
#if _GNU_SOURCE
const char *homedir = getenv("HOME");
std::string path = join_path(homedir, ".pioneer", 0);
DIR *dir = opendir(path.c_str());
if (!dir) {
if (mkdir(path.c_str(), 0770) == -1) {
Gui::Screen::ShowBadError(stringf(128, "Error: Could not create or open '%s'.", path.c_str()).c_str());
}
}
closedir(dir);
if (subdir != "") {
path = join_path(homedir, ".pioneer", subdir.c_str(), 0);
dir = opendir(path.c_str());
if (!dir) {
if (mkdir(path.c_str(), 0770) == -1) {
Gui::Screen::ShowBadError(stringf(128, "Error: Could not create or open '%s'.", path.c_str()).c_str());
}
}
closedir(dir);
}
return path+"/";
#elif _WIN32
try {
TCHAR path[MAX_PATH];
if(S_OK != SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, 0, SHGFP_TYPE_CURRENT, path))
throw std::runtime_error("SHGetFolderPath");
TCHAR temp[MAX_PATH];
MultiByteToWideChar(CP_ACP, 0, "Pioneer", strlen("Pioneer")+1, temp, MAX_PATH);
if(!PathAppend(path, temp))
throw std::runtime_error("PathAppend");
if (subdir != "") {
MultiByteToWideChar(CP_ACP, 0, subdir.c_str(), subdir.size()+1, temp, MAX_PATH);
if(!PathAppend(path, temp))
throw std::runtime_error("PathAppend");
}
if(!PathFileExists(path) && ERROR_SUCCESS != SHCreateDirectoryEx(0, path, 0))
throw std::runtime_error("SHCreateDirectoryEx");
char temp2[MAX_PATH];
WideCharToMultiByte(CP_ACP, 0, path, wcslen(path)+1, temp2, MAX_PATH, 0, 0);
return std::string(temp2)+"/";
}
catch(const std::exception&) {
Gui::Screen::ShowBadError("Can't get path to save directory");
return "";
}
#else
# error Unsupported system
#endif
}
示例15: GetIniPath
static void GetIniPath(void)
{
TCHAR me[MAX_PATH];
HRESULT hResult = SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA|CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, me);
PathAppend(me, _T("TTSwTask"));
SHCreateDirectoryEx(NULL, me, NULL);
PathAppend(me, _T("TTSwTask.ini"));
g_IniPath = CopyString(me);
}