您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetLocalPath函数代码示例

51自学网 2021-06-01 21:10:11
  C++
这篇教程C++ GetLocalPath函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GetLocalPath函数的典型用法代码示例。如果您正苦于以下问题:C++ GetLocalPath函数的具体用法?C++ GetLocalPath怎么用?C++ GetLocalPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GetLocalPath函数的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetLocalPath

bool DirectoryFileSystem::RemoveFile(const std::string &filename) {	std::string fullName = GetLocalPath(filename);#ifdef _WIN32	bool retValue = (::DeleteFileA(fullName.c_str()) == TRUE);#else	bool retValue = (0 == unlink(fullName.c_str()));#endif#if HOST_IS_CASE_SENSITIVE	if (! retValue)	{		// May have failed due to case sensitivity, so try again		fullName = filename;		if ( ! FixPathCase(basePath,fullName, FPC_FILE_MUST_EXIST) )			return false;  // or go on and attempt (for a better error code than just false?)		fullName = GetLocalPath(fullName);#ifdef _WIN32		retValue = (::DeleteFileA(fullName.c_str()) == TRUE);#else		retValue = (0 == unlink(fullName.c_str()));#endif	}#endif	return retValue;}
开发者ID:CrymsonZX,项目名称:ppsspp,代码行数:27,


示例2: GetLocalPath

PSPFileInfo DirectoryFileSystem::GetFileInfo(std::string filename) {	PSPFileInfo x;	x.name = filename;	std::string fullName = GetLocalPath(filename);	if (! File::Exists(fullName)) {#if HOST_IS_CASE_SENSITIVE		if (! FixPathCase(basePath,filename, FPC_FILE_MUST_EXIST))			return x;		fullName = GetLocalPath(filename);		if (! File::Exists(fullName))			return x;#else		return x;#endif	}	x.type = File::IsDirectory(fullName) ? FILETYPE_DIRECTORY : FILETYPE_NORMAL;	x.exists = true;	if (x.type != FILETYPE_DIRECTORY)	{		struct stat s;		stat(fullName.c_str(), &s);		x.size = File::GetSize(fullName);		x.access = s.st_mode & 0x1FF;		localtime_r((time_t*)&s.st_atime,&x.atime);		localtime_r((time_t*)&s.st_ctime,&x.ctime);		localtime_r((time_t*)&s.st_mtime,&x.mtime);	}	return x;}
开发者ID:MoonSnidget,项目名称:ppsspp,代码行数:34,


示例3: GetLocalPath

int DirectoryFileSystem::RenameFile(const std::string &from, const std::string &to) {	std::string fullTo = to;	// Rename ignores the path (even if specified) on to.	size_t chop_at = to.find_last_of('/');	if (chop_at != to.npos)		fullTo = to.substr(chop_at + 1);	// Now put it in the same directory as from.	size_t dirname_end = from.find_last_of('/');	if (dirname_end != from.npos)		fullTo = from.substr(0, dirname_end + 1) + fullTo;	// At this point, we should check if the paths match and give an already exists error.	if (from == fullTo)		return SCE_KERNEL_ERROR_ERRNO_FILE_ALREADY_EXISTS;	std::string fullFrom = GetLocalPath(from);#if HOST_IS_CASE_SENSITIVE	// In case TO should overwrite a file with different case	if ( ! FixPathCase(basePath,fullTo, FPC_PATH_MUST_EXIST) )		return -1;  // or go on and attempt (for a better error code than just false?)#endif	fullTo = GetLocalPath(fullTo);	const char * fullToC = fullTo.c_str();#ifdef _WIN32_NO_MINGW	bool retValue = (MoveFile(ConvertUTF8ToWString(fullFrom).c_str(), ConvertUTF8ToWString(fullToC).c_str()) == TRUE);#else	bool retValue = (0 == rename(fullFrom.c_str(), fullToC));#endif#if HOST_IS_CASE_SENSITIVE	if (! retValue)	{		// May have failed due to case sensitivity on FROM, so try again		fullFrom = from;		if ( ! FixPathCase(basePath,fullFrom, FPC_FILE_MUST_EXIST) )			return -1;  // or go on and attempt (for a better error code than just false?)		fullFrom = GetLocalPath(fullFrom);#ifdef _WIN32_NO_MINGW		retValue = (MoveFile(fullFrom.c_str(), fullToC) == TRUE);#else		retValue = (0 == rename(fullFrom.c_str(), fullToC));#endif	}#endif	// TODO: Better error codes.	return retValue ? 0 : (int)SCE_KERNEL_ERROR_ERRNO_FILE_ALREADY_EXISTS;}
开发者ID:BrainDamage,项目名称:libretro-ppsspp,代码行数:54,


示例4: MkDir

bool DirectoryFileSystem::MkDir(const std::string &dirname) {#if HOST_IS_CASE_SENSITIVE	// Must fix case BEFORE attempting, because MkDir would create	// duplicate (different case) directories	std::string fixedCase = dirname;	if ( ! FixPathCase(basePath,fixedCase, FPC_PARTIAL_ALLOWED) )		return false;	return File::CreateFullPath(GetLocalPath(fixedCase));#else	return File::CreateFullPath(GetLocalPath(dirname));#endif}
开发者ID:BrainDamage,项目名称:libretro-ppsspp,代码行数:14,


示例5: GetLocalPath

NS_IMETHODIMP nsPop3IncomingServer::MarkMessages(){  nsresult rv;  if (m_runningProtocol)    rv = m_runningProtocol->MarkMessages(&m_uidlsToMark);  else  {    nsCString hostName;    nsCString userName;    nsCOMPtr<nsIFile> localPath;    GetLocalPath(getter_AddRefs(localPath));    GetHostName(hostName);    GetUsername(userName);    // do it all in one fell swoop    rv = nsPop3Protocol::MarkMsgForHost(hostName.get(), userName.get(), localPath, m_uidlsToMark);  }  uint32_t count = m_uidlsToMark.Length();  for (uint32_t i = 0; i < count; i++)  {    Pop3UidlEntry *ue = m_uidlsToMark[i];    PR_Free(ue->uidl);    PR_Free(ue);  }  m_uidlsToMark.Clear();  return rv;}
开发者ID:SphereWeb,项目名称:releases-comm-central,代码行数:28,


示例6: handleDirectoriesToSyncUpdated

	void SyncManager::handleDirectoriesToSyncUpdated (const QList<SyncerInfo>& infos)	{		QStringList paths;		for (const auto& info : infos)		{			paths << info.LocalDirectory_;			auto acc = AM_->GetAccountFromUniqueID (info.AccountId_);			if (AccountID2Syncer_.contains (info.AccountId_))			{				auto syncer = AccountID2Syncer_ [info.AccountId_];				if (syncer->GetLocalPath () == info.LocalDirectory_ &&						syncer->GetRemotePath () == info.RemoteDirectory_)					continue;				else				{					//TODO update syncer// 					syncer->stop ();// 					AccountID2Syncer_.take (info.AccountId_)->deleteLater ();				}			}			else			{				auto syncer = CreateSyncer (acc, info.LocalDirectory_, info.RemoteDirectory_);				AccountID2Syncer_ [info.AccountId_] = syncer;// 				syncer->start ();			}		}		FilesWatcher_->updatePaths (paths);	}
开发者ID:ForNeVeR,项目名称:leechcraft,代码行数:32,


示例7: ERROR_LOG

u32 VFSFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename) {	if (access != FILEACCESS_READ) {		ERROR_LOG(FILESYS, "VFSFileSystem only supports plain reading");		return 0;	}	std::string fullName = GetLocalPath(filename);	const char *fullNameC = fullName.c_str();	DEBUG_LOG(FILESYS,"VFSFileSystem actually opening %s (%s)", fullNameC, filename.c_str());	size_t size;	u8 *data = VFSReadFile(fullNameC, &size);	if (!data) {		ERROR_LOG(FILESYS, "VFSFileSystem failed to open %s", filename.c_str());		return 0;	}	OpenFileEntry entry;	entry.fileData = data;	entry.size = size;	entry.seekPos = 0;	u32 newHandle = hAlloc->GetNewHandle();	entries[newHandle] = entry;	return newHandle;}
开发者ID:BrainDamage,项目名称:libretro-ppsspp,代码行数:25,


示例8: GetLocalPath

bool DirectoryFileSystem::MkDir(const std::string &dirname){	std::string fullName = GetLocalPath(dirname);	return File::CreateFullPath(fullName);}
开发者ID:Myoko,项目名称:ppsspp,代码行数:7,


示例9: ASSERT

	ERMsg CDirectoryManagerBase::Import(const std::string& filePath, const std::string& fileExt)const	{		ASSERT(!filePath.empty());		ASSERT(m_bHaveLocalPath);		ASSERT(!m_localPath.empty());		ERMsg msg;		if (!GetLocalPath().empty())		{			ASSERT(false);			//std::string newName = GetLocalPath() + UtilWin::GetFileTitle( filePath ) + fileExt;			//if( !DirExist(GetLocalPath()) )			//{			//	if( !CreateMultipleDir( GetLocalPath() ) )			//	{			//		msg.asgType(ERMsg::ERREUR);			//		return msg;			//	}			//}			//if( !::CopyFile( filePath, newName, true) )			//      {			//	msg = SYGetMessage( GetLastError() );			//          std::string erreur;			//          erreur.FormatMsg(IDS_CMN_FILENOTIMPORT, (LPCTSTR)filePath, (LPCTSTR)GetLocalPath() );			//          msg.ajoute(erreur);			//      }		}		return msg;	}
开发者ID:RNCan,项目名称:WeatherBasedSimulationFramework,代码行数:34,


示例10: DepotMatchingRepositoryListener

status_tServerRepositoryDataUpdateProcess::ProcessLocalData(){	DepotMatchingRepositoryListener* itemListener =		new DepotMatchingRepositoryListener(fModel, this);	ObjectDeleter<DepotMatchingRepositoryListener>		itemListenerDeleter(itemListener);	BulkContainerDumpExportRepositoryJsonListener* listener =		new BulkContainerDumpExportRepositoryJsonListener(itemListener);	ObjectDeleter<BulkContainerDumpExportRepositoryJsonListener>		listenerDeleter(listener);	BPath localPath;	status_t result = GetLocalPath(localPath);	if (result != B_OK)		return result;	result = ParseJsonFromFileWithListener(listener, localPath);	if (result != B_OK)		return result;	return listener->ErrorStatus();}
开发者ID:looncraz,项目名称:haiku,代码行数:26,


示例11: GetLocalPath

bool DirectoryFileSystem::RmDir(const std::string &dirname){	std::string fullName = GetLocalPath(dirname);#ifdef _WIN32	return RemoveDirectory(fullName.c_str()) == TRUE;#else  return 0 == rmdir(fullName.c_str());#endif}
开发者ID:SanJaroICS,项目名称:ppsspp,代码行数:9,


示例12: SetLocalCurrentDir

//=============================================================================// 函数名称:	设置当前工作目录// 作者说明:	mushuai// 修改时间:	2010-03-08//=============================================================================BOOL SetLocalCurrentDir(){	CString path=GetLocalPath();	path+='//';	DWORD dwret=SetCurrentDirectory(path.GetBuffer(0));	if (dwret==0)		return FALSE;	return TRUE;}
开发者ID:ChenzhenqingCC,项目名称:WinProjects,代码行数:14,


示例13: GetLocalPath

PSPFileInfo DirectoryFileSystem::GetFileInfo(std::string filename) {	PSPFileInfo x;	x.name = filename;	std::string fullName = GetLocalPath(filename);	if (!File::Exists(fullName)) {#if HOST_IS_CASE_SENSITIVE		if (! FixPathCase(basePath,filename, FPC_FILE_MUST_EXIST))			return x;		fullName = GetLocalPath(filename);		if (! File::Exists(fullName))			return x;#else		return x;#endif	}	x.type = File::IsDirectory(fullName) ? FILETYPE_DIRECTORY : FILETYPE_NORMAL;	x.exists = true;	if (x.type != FILETYPE_DIRECTORY) {		File::FileDetails details;		if (!File::GetFileDetails(fullName, &details)) {			ERROR_LOG(FILESYS, "DirectoryFileSystem::GetFileInfo: GetFileDetails failed: %s", fullName.c_str());			x.size = 0;			x.access = 0;			memset(&x.atime, 0, sizeof(x.atime));			memset(&x.ctime, 0, sizeof(x.ctime));			memset(&x.mtime, 0, sizeof(x.mtime));		} else {			x.size = details.size;			x.access = details.access;			time_t atime = details.atime;			time_t ctime = details.ctime;			time_t mtime = details.mtime;			localtime_r((time_t*)&atime, &x.atime);			localtime_r((time_t*)&ctime, &x.ctime);			localtime_r((time_t*)&mtime, &x.mtime);		}	}	return x;}
开发者ID:VOID001,项目名称:ppsspp,代码行数:44,


示例14: return

int VirtualDiscFileSystem::getFileListIndex(std::string &fileName){	std::string normalized;	if (fileName.length() >= 1 && fileName[0] == '/') {		normalized = fileName.substr(1);	} else {		normalized = fileName;	}	for (size_t i = 0; i < fileList.size(); i++)	{		if (fileList[i].fileName == normalized)			return (int)i;	}	// unknown file - add it	std::string fullName = GetLocalPath(fileName);	if (! File::Exists(fullName)) {#if HOST_IS_CASE_SENSITIVE		if (! FixPathCase(basePath,fileName, FPC_FILE_MUST_EXIST))			return -1;		fullName = GetLocalPath(fileName);		if (! File::Exists(fullName))			return -1;#else		return -1;#endif	}	FileType type = File::IsDirectory(fullName) ? FILETYPE_DIRECTORY : FILETYPE_NORMAL;	if (type == FILETYPE_DIRECTORY)		return -1;	FileListEntry entry = {""};	entry.fileName = normalized;	entry.totalSize = File::GetFileSize(fullName);	entry.firstBlock = currentBlockIndex;	currentBlockIndex += (entry.totalSize+2047)/2048;	fileList.push_back(entry);	return (int)fileList.size()-1;}
开发者ID:Alceris,项目名称:ppsspp,代码行数:44,


示例15: localFile

/*----------------------------------------------------------------------  Save an opened document to a specified path in order to open.  The parameter doc is the original doc to be saved  The parameter newdoc is the new document  The parameter newpath is the newdoc URI  Return the saved localFile (to be freed) or NULL  ----------------------------------------------------------------------*/char *SaveDocumentToNewDoc(Document doc, Document newdoc, char* newpath){  ElementType   elType;  Element       root;  char         *localFile = NULL, *s;  ThotBool      res = FALSE;  localFile = GetLocalPath (newdoc, newpath);  // apply link changes to the template    TtaOpenUndoSequence (doc, NULL, NULL, 0, 0);  SetRelativeURLs (doc, newpath, NULL, FALSE, FALSE, FALSE, FALSE);  // prepare the new document view  TtaExtractName (newpath, DirectoryName, DocumentName);  root = TtaGetRootElement(doc);  elType = TtaGetElementType (root);  // get the target document type  s = TtaGetSSchemaName (elType.ElSSchema);  if (!IsNotHTMLorHTML5 (s))    {	  if (TtaGetDocumentProfile(doc) == L_HTML5 || TtaGetDocumentProfile(doc) == L_HTML5_LEGACY)		 res = TtaExportDocumentWithNewLineNumbers (doc, localFile, "HTML5TX", FALSE);	  else	  {		  /* docType = docHTML; */		  if (TtaGetDocumentProfile(doc) == L_Xhtml11 ||			  TtaGetDocumentProfile(doc) == L_Basic)			res = TtaExportDocumentWithNewLineNumbers (doc, localFile, "HTMLT11", FALSE);		  else			res = TtaExportDocumentWithNewLineNumbers (doc, localFile, "HTMLTX", FALSE);	  }    }  else if (strcmp (s, "SVG") == 0)    /* docType = docSVG; */    res = TtaExportDocumentWithNewLineNumbers (doc, localFile, "SVGT", FALSE);  else if (strcmp (s, "MathML") == 0)    /* docType = docMath; */    res = TtaExportDocumentWithNewLineNumbers (doc, localFile, "MathMLT", FALSE);  else    /* docType = docXml; */    res = TtaExportDocumentWithNewLineNumbers (doc, localFile, NULL, FALSE);  // restore the previous state of the template  TtaCloseUndoSequence (doc);  TtaUndoNoRedo (doc);  if (res)    return localFile;  else    {      TtaFreeMemory (localFile);      return NULL;    }}
开发者ID:ezura,项目名称:Amaya,代码行数:62,


示例16: GetLocalPath

int CUpdator::Log(LPCTSTR msg){	static SampleTxtLogger slog;	if (!slog.m_state)	{		CString spath = GetLocalPath()+_T("//log.txt");		slog.Initialize(spath);	}	slog.Log(0,_T("%s"),msg);	return 0;}
开发者ID:ChenzhenqingCC,项目名称:WinProjects,代码行数:11,


示例17: GetLocalPath

bool DirectoryFileSystem::RenameFile(const std::string &from, const std::string &to) {	std::string fullTo = to;	// Rename only work for filename in current directory	std::string fullFrom = GetLocalPath(from);#if HOST_IS_CASE_SENSITIVE	// In case TO should overwrite a file with different case	if ( ! FixPathCase(fullTo, FPC_PATH_MUST_EXIST) )		return false;  // or go on and attempt (for a better error code than just false?)#endif	fullTo = GetLocalPath(fullTo);	const char * fullToC = fullTo.c_str();#ifdef _WIN32	bool retValue = (MoveFile(fullFrom.c_str(), fullToC) == TRUE);#else	bool retValue = (0 == rename(fullFrom.c_str(), fullToC));#endif#if HOST_IS_CASE_SENSITIVE	if (! retValue)	{		// May have failed due to case sensitivity on FROM, so try again		fullFrom = from;		if ( ! FixPathCase(fullFrom, FPC_FILE_MUST_EXIST) )			return false;  // or go on and attempt (for a better error code than just false?)		fullFrom = GetLocalPath(fullFrom);#ifdef _WIN32		retValue = (MoveFile(fullFrom.c_str(), fullToC) == TRUE);#else		retValue = (0 == rename(fullFrom.c_str(), fullToC));#endif	}#endif	return retValue;}
开发者ID:Bennieboj,项目名称:ppsspp,代码行数:41,


示例18: CreateMultipleDir

	//this default implementation import all file in the same directory	//that have the same file title	ERMsg CDirectoryManager::Import(const std::string& filePath)const	{		ERMsg msg;		if (!GetLocalPath().empty())		{			if (!DirectoryExists(GetLocalPath()))			{				msg = CreateMultipleDir(GetLocalPath());			}			if (msg)			{				std::string newFilePath = GetLocalPath() + GetFileName(filePath);				msg = CopyFile(filePath, newFilePath);				/*std::string strSrh = filePath;				UtilWin::SetFileExtension(strSrh, ".*");				StringVector filePathList;				UtilWin::GetFilesList(filePathList, strSrh, true);				for(int i=0; i<filePathListsize(); i++)				{				std::string newFilePath = GetLocalPath() + UtilWin::GetFileName( filePathList[i] );				if( !::CopyFile( filePathList[i], newFilePath, true) )				{				msg = SYGetMessage( GetLastError() );				std::string erreur;				erreur.FormatMsg(IDS_CMN_FILENOTIMPORT, (LPCTSTR)filePath, (LPCTSTR)GetLocalPath() );				msg.ajoute(erreur);				}				}*/			}		}		return msg;	}
开发者ID:RNCan,项目名称:WeatherBasedSimulationFramework,代码行数:42,


示例19: AddTextElement

void CFolderItem::SaveItem(pugi::xml_node& element) const{    auto file = element.append_child("Folder");    if (Download()) {        AddTextElement(file, "LocalFile", GetLocalPath().GetPath() + GetLocalFile());    }    else {        AddTextElement(file, "RemoteFile", GetRemoteFile());        AddTextElement(file, "RemotePath", m_remotePath.GetSafePath());    }    AddTextElementUtf8(file, "Download", Download() ? "1" : "0");}
开发者ID:comutt,项目名称:FileZilla3,代码行数:13,


示例20: TiXmlElement

void CFolderItem::SaveItem(TiXmlElement* pElement) const{	TiXmlElement *file = new TiXmlElement("Folder");	if (Download())		AddTextElement(file, "LocalFile", GetLocalPath().GetPath() + GetLocalFile());	else	{		AddTextElement(file, "RemoteFile", GetRemoteFile());		AddTextElement(file, "RemotePath", m_remotePath.GetSafePath());	}	AddTextElementRaw(file, "Download", Download() ? "1" : "0");	pElement->LinkEndChild(file);}
开发者ID:bugiii,项目名称:filezilla3ex,代码行数:15,


示例21: LOG

void CUpdator::UpdateRestart(){	if(m_updatee)	{		//waiting updatee quit		CString msg;		msg.Format(_T("wait updatee quit:%d"),m_updatee);		LOG((LPCTSTR)msg);		if(::WaitForSingleObject(m_updatee,INFINITE) != WAIT_OBJECT_0)		{			//msg.Format(_T("wait updatee error"));			//MessageBox(0,(LPCTSTR)msg,0,MB_OK);		}		CloseHandle(m_updatee);		m_updatee =0;		//re update		Sleep(20);		int  r = PreUpdate();	}	LOG(_T("re start updatee"));	for (int i=0;i<m_services.size();i++)	{		CString service = GetLocalPath()+m_services[i].c_str();		Execute(service,"/service");	}	Sleep(200);	if(m_updatee_path.length())	{		Execute(GetLocalPath()+m_updatee_path.c_str(),"/service");		Sleep(200);		Execute(GetLocalPath()+m_updatee_path.c_str());	}	}
开发者ID:ChenzhenqingCC,项目名称:WinProjects,代码行数:36,


示例22: ConvertUTF8ToWString

u64 DirectoryFileSystem::FreeSpace(const std::string &path) {#ifdef _WIN32	const std::wstring w32path = ConvertUTF8ToWString(GetLocalPath(path));	ULARGE_INTEGER free;	if (GetDiskFreeSpaceExW(w32path.c_str(), &free, nullptr, nullptr))		return free.QuadPart;#elif defined(__SYMBIAN32__)	QSystemStorageInfo storageInfo;	return (u64)storageInfo.availableDiskSpace("E");#else	std::string localPath = GetLocalPath(path);	struct statvfs diskstat;	int res = statvfs(localPath.c_str(), &diskstat);#if HOST_IS_CASE_SENSITIVE	std::string fixedCase = path;	if (res != 0 && FixPathCase(basePath, fixedCase, FPC_FILE_MUST_EXIST)) {		// May have failed due to case sensitivity, try again.		localPath = GetLocalPath(fixedCase);		res = statvfs(localPath.c_str(), &diskstat);	}#endif	if (res == 0) {#ifndef ANDROID		if (diskstat.f_flag & ST_RDONLY) {			return 0;		}#endif		return (u64)diskstat.f_bavail * (u64)diskstat.f_frsize;	}#endif	// Just assume they're swimming in free disk space if we don't know otherwise.	return std::numeric_limits<u64>::max();}
开发者ID:VOID001,项目名称:ppsspp,代码行数:36,



注:本文中的GetLocalPath函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GetLocalTime函数代码示例
C++ GetLocalOrigin函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。