本文整理汇总了C++中GetAppPath函数的典型用法代码示例。如果您正苦于以下问题:C++ GetAppPath函数的具体用法?C++ GetAppPath怎么用?C++ GetAppPath使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetAppPath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openTemporaryFile
CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle)
{
char appPath[MAX_PATH];
if (WideCharToMultiByte(CP_ACP,
0,
GetAppPath(),
wcslen(GetAppPath()),
appPath,
MAX_PATH - 1,
NULL,
NULL
) > 0)
{
static int tempFileId = 0;
char tempFile[MAX_PATH];
int fileNameLen = sprintf(tempFile, "%s\\%s%04d.tmp", appPath, prefix, tempFileId++);
if (tempFileId >= 9999)
tempFileId = 0;
if (fileNameLen > 0)
{
HANDLE tempHandle = ::CreateFileA(tempFile, GENERIC_READ | GENERIC_WRITE, 0, 0,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (isHandleValid(tempHandle)) {
handle = tempHandle;
return tempFile;
}
}
}
return 0;
}
示例2: GetAppPath
BOOL CStkDatabase::InitInstance()
{
GetAppPath();
CreateDirectory(GetAppPath() + _T("\\Data"), NULL);
CStringArray block;
CStkBlockDzh dzhBlock;
dzhBlock.EnumAllType(block);
CStringArray arrBlock;
dzhBlock.EnumBlockNames(_T("ÐÐÒµ"), arrBlock);
int nSize = arrBlock.GetSize();
for (int i = 0; i < nSize; i++)
{
CString strBlock = arrBlock.GetAt(i);
CStringArray arrStock;
dzhBlock.ReadSymbols(strBlock, arrStock);
//if (GetBlockManager()->CheckBlockName(strBlock.GetBuffer(0), NULL) == FALSE)
//{
// PSTOCKTYPEINFO pBlock;
// int nPos = GetBlockManager()->GetInsertStockTypePos();
// GetBlockManager()->InsertStockType(pBlock, nPos);
//}
}
return TRUE;
}
示例3: GetCurrentParamsPath
void GetCurrentParamsPath(TSTRING &tsPath) {
RegistryKey Key;
if (!Key.Create(FURR_ROOTREGISTRYKEY, FURR_REGISTRYCONFIGSPATH)) {
MessageBox(GetForegroundWindow(), _T("Failed to open registry key that contains current image parameters file path;")
_T(" reverting to defaults."), _T("FURR - Error"), MB_OK | MB_ICONSTOP);
GetAppPath(tsPath);
tsPath += FURR_DEFIMAGEPARAMSFILE;
}
if (!Key.ReadString(FURR_CURIMAGEPARAMSVALUE, tsPath)) {
MessageBox(GetForegroundWindow(), _T("Failed to read registry key that contains current image parameters file path;")
_T(" reverting to defaults."), _T("FURR - Error"), MB_OK | MB_ICONSTOP);
GetAppPath(tsPath);
tsPath += FURR_DEFIMAGEPARAMSFILE;
}
if (_T("") == tsPath) {
MessageBox(GetForegroundWindow(), _T("No current image parameters file is saved in the registry; reverting to defaults."),
_T("FURR - Information"), MB_OK | MB_ICONINFORMATION);
GetAppPath(tsPath);
tsPath += FURR_DEFIMAGEPARAMSFILE;
}
}
示例4: Randomize
//---------------------------------------------------------------------------
void __fastcall TMainForm::AddPhoto(AnsiString existingFileName)
{
AnsiString photoFile = "";
AnsiString hash = "";
if (existingFileName.IsEmpty()) {
Randomize();
hash = GetMD5Hash(AnsiString(Random(99999999999999999999999999999999)));
photoFile = GetAppPath()+"Photo\\"+hash+".jpg";
} else {
hash = existingFileName;
}
photoFile = GetAppPath()+"Photo\\"+hash+".jpg";
if (OpenPictureDialog->Execute()) {
if (!OpenPictureDialog->FileName.IsEmpty()) {
if (FileExists(OpenPictureDialog->FileName)) {
int ID = DBGrid->Fields[14]->AsInteger;
AnsiString query = "UPDATE tblMembers SET mPhoto = '" + hash + "' WHERE ID = " + AnsiString(ID);
CMData->ADOQuery->SQL->Clear();
CMData->ADOQuery->SQL->Add(query);
CMData->ADOQuery->ExecSQL();
query = AnsiString("select mSur, mName, mPat, mBD, mCD, mNat, mAdd, mTel, mFam, mPro, ") +
AnsiString ("mLife, mSug, mEtc, mPhoto, ID from tblMembers order by mSur, mName, mPat");
CMData->ADOQuery->SQL->Clear();
CMData->ADOQuery->SQL->Add(query);
CMData->ADOQuery->Open();
CopyFile(OpenPictureDialog->FileName.c_str(), photoFile.c_str(), false);
} else {
MessageDlg("Файл '" + OpenPictureDialog->FileName + "' не найден!", mtError, TMsgDlgButtons() << mbOK, 0);
}
}
}
}
示例5: _T
// 根据指定的相对路径获取绝对路径
tstring CPath::GetFullPath(LPCTSTR lpszPath)
{
if (NULL == lpszPath || NULL == *lpszPath)
return _T("");
tstring strPath(lpszPath);
tstring::iterator iter;
for (iter = strPath.begin(); iter < strPath.end(); iter++)
{
if (_T('\\') == *iter)
*iter = _T('/');
}
TCHAR cFirstChar = strPath.at(0);
TCHAR cSecondChar = strPath.at(1);
if (cFirstChar == _T('/'))
{
tstring strCurDir = GetAppPath();
tstring strRootPath = GetPathRoot(strCurDir.c_str());
return strRootPath + strPath;
}
else if (::IsCharAlpha(cFirstChar) && cSecondChar == _T(':'))
{
return strPath;
}
else
{
tstring strCurDir = GetAppPath();
return strCurDir + strPath;
}
}
示例6: InitComposer
bool iComposer::InitComposer(iMapHandler* pmap)
{
m_pMap=pmap;
iDibLoader::LoadPng(m_dibSelCell,GetAppPath()+_T("cell_sel.png"));
iDibLoader::LoadPng(m_dibSelNode,GetAppPath()+_T("node_sel.png"));
iDibLoader::LoadPng(m_dibGrid,GetAppPath()+_T("cell_grid.png"));
iDibLoader::LoadPng(m_dibRedCell,GetAppPath()+_T("cell_red.png"));
iDibLoader::LoadPng(m_dibYelCell,GetAppPath()+_T("cell_yel.png"));
m_ComposeMemDC.InitDC(iSize(100,100));
return true;
}
示例7: data
bool CodeBlocksApp::LoadConfig()
{
if (m_UserDataDir!=wxEmptyString)
{
// if --user-data-dir=path was specified we tell
//ConfigManager (and CfgMgrBldr) about it, which will propagate
//it through the app and plugins
if ( !ConfigManager::SetUserDataFolder(m_UserDataDir) )
return false;
}
ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("app"));
wxString data(wxT(APP_PREFIX));
if (platform::windows)
data.assign(GetAppPath());
else if (platform::macosx)
{
data.assign(GetResourcesDir()); // CodeBlocks.app/Contents/Resources
if (!data.Contains(wxString(_T("/Resources")))) // not a bundle, use relative path
data = GetAppPath() + _T("/..");
}
if (data.IsEmpty())
{
data.assign(GetAppPath()); // fallback
data.Replace(_T("/bin"),_T(""));
}
if (!m_Prefix.IsEmpty()) // --prefix command line switch overrides builtin value
data = m_Prefix;
else // also, check for environment
{
wxString env;
wxGetEnv(_T("CODEBLOCKS_DATA_DIR"), &env);
if (!env.IsEmpty())
data = env;
}
data.append(_T("/share/codeblocks"));
cfg->Write(_T("data_path"), data);
//m_HasDebugLog = Manager::Get()->GetConfigManager(_T("message_manager"))->ReadBool(_T("/has_debug_log"), false) || m_HasDebugLog;
//Manager::Get()->GetConfigManager(_T("message_manager"))->Write(_T("/has_debug_log"), m_HasDebugLog);
return true;
}
示例8: Initialize
static bool Initialize()
{
if(CountRunnings()>1)
{
ClipboardPutW(L"!DCMapCmd!{bring_to_top}");
return false;
}
DCMapSys = dcmapsysInit();
if(!DCMapSys)return false;
g_pDCMapSys = DCMapSys;
DCMapSys->SetUI(&SysUI);
String AppPath = GetAppPath();
// Create all system directories
ForceDirectories(AppPath+"data");
ForceDirectories(AppPath+"backup");
ForceDirectories(AppPath+"plugins");
ForceDirectories(AppPath+"sessions");
ForceDirectories(AppPath+"templates");
ForceDirectories(AppPath+"skins");
ForceDirectories(AppPath+"scripts");
String FileName = AppPath+"update.exe";;
if(FileExists(FileName))DeleteFile(FileName);
g_pLocalStrings = dcmapsysLocalize((AppPath+"dcmap.lng").w_str());
g_pLocalStrings->UpdateFrom((AppPath+"dcmapdev.lng").w_str());
g_pLocalStrings->UpdateFrom((AppPath+"dcmap.user.lng").w_str());
RegisterModules(g_pDCMapSys);
return true;
}
示例9: DeleteXmlFile
bool DeleteXmlFile(string& szFileName, int& m_ID, sockaddr_in& m_sockaddr)
{
string m_ip = inet_ntoa(m_sockaddr.sin_addr);
string m_id = itos(m_ID);
string m_port = itos(ntohs(m_sockaddr.sin_port));
CString appPath = GetAppPath();
string seperator = "\\";
string fullPath = appPath.GetBuffer(0) +seperator+szFileName;
TiXmlDocument *myDocument = new TiXmlDocument(fullPath.c_str());
myDocument->LoadFile();
TiXmlElement *RootElement = myDocument->RootElement();
TiXmlElement* pNode = NULL;
for(pNode = RootElement->FirstChildElement(); pNode; pNode = pNode->NextSiblingElement()){
if(!strcmp(pNode->Value(), "Server") && !strcmp(pNode->Attribute("ID"), m_id.c_str())){
cout<<pNode->Value()<<pNode->Attribute("ID")<<endl;
RootElement->RemoveChild(pNode);
break;
}
}
myDocument->SaveFile(fullPath.c_str());//保存到文件
return true;
}
示例10: getenv
char *SetFlasccSDKLocation(const char *suffix) {
static char FlasccSDKLocation[PATH_MAX] = "";
char *dest = &FlasccSDKLocation[0];
int slen;
if(!FlasccSDKLocation[0]) {
const char *sdkenv = getenv("FLASCC_INTERNAL_SDK_ROOT");
if(sdkenv) {
strncpy(dest, sdkenv, PATH_MAX);
} else {
unsigned int sz = PATH_MAX;
GetAppPath(dest, &sz);
/* Append the suffix to the exe path to give the final flascc sdk path */
char *lastslash = strrchr(dest, '/');
slen = strlen(suffix);
if(sz+slen+1 > PATH_MAX)
return 0;
strncpy(lastslash, suffix, slen+1);
/* so that we can access this easily from subprocesses/plugins */
#ifdef __MINGW32__
// can we get away with not doing this if we only need llvm compiled with mingw?
#else
setenv("FLASCC_INTERNAL_SDK_ROOT", &FlasccSDKLocation[0], 0);
#endif
}
}
return &FlasccSDKLocation[0];
}
示例11: GetAppPath
//初始化函数
bool CBaseMainManageForZ::Init(ManageInfoStruct * pInitData, IDataBaseHandleService * pDataHandleService)
{
if ((this==NULL)||(m_bInit==true)) return false;
//设置数据
UINT uMax=pInitData->uMaxPeople;//20081201
m_InitData=*pInitData;
if (!PreInitParameter(&m_InitData,&m_KernelData)) throw new CAFCException(TEXT("CBaseMainManageForZ::Init PreInitParameter 参数调节错误"),0x41A);
if(m_InitData.uMaxPeople<uMax)//20081201
m_InitData.uMaxPeople=uMax;
//初始化组件
if (m_KernelData.bStartTCPSocket) m_TCPSocket.Init(m_InitData.uMaxPeople,m_InitData.uListenPort,m_KernelData.bMaxVer,m_KernelData.bLessVer,m_InitData.iSocketSecretKey,this);
if (m_KernelData.bStartSQLDataBase)
{
if (pDataHandleService!=NULL) pDataHandleService->SetParameter(this,&m_SQLDataManage,&m_InitData,&m_KernelData);
m_SQLDataManage.Init(&m_InitData,&m_KernelData,pDataHandleService,this);
}
//调用接口
if (OnInit(&m_InitData,&m_KernelData)==false) throw new CAFCException(TEXT("CBaseMainManageForZ::Init OnInit 函数错误"),0x41B);
m_bInit=true;
CString s = GetAppPath();
m_TalkFilter.LoadFilterMessage(s.GetBuffer());
return true;
}
示例12: Assert
bool PeerManage::DelayInitialize()
{
if (NULL == (m_pCallBackSystem = (CallBackSystem *)m_pCoreModuleManage->GetModule("CallBackSystem")))
{
Assert(false);
LOG_ERROR("Get CallBackSystem error");
return false;
}
char strConfigPath[PATH_LENGTH] = {0};
const char * pStrPathFolder = GetAppPath();
sprintf_s(strConfigPath, "%s/%s", pStrPathFolder, CONFIG_PATH_PEERCONFIG);
TiXmlDocument xmlConfig;
if (false == xmlConfig.LoadFile(strConfigPath))
{
LOG_ERROR("Load PeerManage Error");
return false;
}
TiXmlElement * pRootElement = xmlConfig.RootElement();
TiXmlElement * pPeerTypeElm = pRootElement->FirstChildElement("PeerType");
while (pPeerTypeElm != NULL)
{
if (false == GetConfig(pPeerTypeElm))
{
LOG_ERROR("Load PeerManage Error");
}
pPeerTypeElm = pPeerTypeElm->NextSiblingElement();
}
return true;
}
示例13: GetAppPath
void CRuleManager::WriteFavToFile()
{
TFileName filename;
GetAppPath(filename);
filename.Append(KFavRuleFile);
int pos = filename.LocateReverse('\\');
if (pos != KErrNotFound)
{
TPtrC dirName = filename.Left(pos + 1);
CCoeEnv::Static()->FsSession().MkDirAll(dirName);
}
RFile file;
TInt err;
err = file.Replace(CCoeEnv::Static()->FsSession(), filename,
EFileWrite);
if (KErrNone != err)
{
return;
}
CleanupClosePushL(file);
WriteToFile(file,iFavRule);
TBuf8<4> num;
num.AppendNum(iFavRule->GetFavCount());
file.Write(num);
CleanupStack::PopAndDestroy(); // file
}
示例14: TMsgDlgButtons
//---------------------------------------------------------------------------
void __fastcall TMainForm::DeleteMemPhotoButtonClick(TObject *Sender)
{
if (!DBGrid->Fields[13]->AsString.IsEmpty()) {
if (MessageDlg("Вы уверены, что хотите удалить фото в этой записи?",
mtWarning, TMsgDlgButtons() << mbYes << mbNo, 0) == 6) {
AnsiString photoFile = GetAppPath()+"Photo\\"+DBGrid->Fields[13]->AsString+".jpg";
int ID = DBGrid->Fields[14]->AsInteger;
AnsiString query = "UPDATE tblMembers SET mPhoto = '' WHERE ID = " + AnsiString(ID);
CMData->ADOQuery->SQL->Clear();
CMData->ADOQuery->SQL->Add(query);
CMData->ADOQuery->ExecSQL();
query = AnsiString("select mSur, mName, mPat, mBD, mCD, mNat, mAdd, mTel, mFam, mPro, ") +
AnsiString ("mLife, mSug, mEtc, mPhoto, ID from tblMembers order by mSur, mName, mPat");
CMData->ADOQuery->SQL->Clear();
CMData->ADOQuery->SQL->Add(query);
CMData->ADOQuery->Open();
if (FileExists(photoFile)) {
DeleteFileA(photoFile);
} else {
MessageDlg("Файл '" + photoFile + "' не найден!", mtError, TMsgDlgButtons() << mbOK, 0);
}
}
} else
MessageDlg("Данная запись не содержит фото!", mtWarning, TMsgDlgButtons() << mbOK, 0);
}
示例15: GetAppPath
void CConnectRemoteMachineWindow::loadHistory()
{
CString appPath = GetAppPath();
CString fullPath = appPath + L"\\histroycommands1.xml";
char fname[4096] = {0};
int len = WideCharToMultiByte(CP_ACP, 0, fullPath, fullPath.GetLength(), NULL, 0, NULL, NULL);
WideCharToMultiByte(CP_ACP,0, fullPath, fullPath.GetLength(), fname, len, NULL, NULL);
fname[len + 1] = '\0';
TiXmlDocument *pDocument = new TiXmlDocument(fname);
if(pDocument == NULL || !pDocument->LoadFile(TIXML_ENCODING_UTF8))
return;
TiXmlElement *rootElement = pDocument->RootElement();
TiXmlNode* node = rootElement->FirstChild();
if(node)
{
do
{
std::string c = node->FirstChild()->Value();
wchar_t* strCommand = strutil::char2wchar(c.c_str());
m_historyCommand.push_back(strCommand);
free(strCommand);
}while((node = node->NextSibling()));
}
pDocument->Clear();
delete pDocument;
}