• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetLocalPath函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了GetLocalPath函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:DirectoryFileSystem.cpp


示例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,代码来源:DirectoryFileSystem.cpp


示例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,代码来源:DirectoryFileSystem.cpp


示例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,代码来源:DirectoryFileSystem.cpp


示例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,代码来源:nsPop3IncomingServer.cpp


示例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,代码来源:syncmanager.cpp


示例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,代码来源:DirectoryFileSystem.cpp


示例8: GetLocalPath

bool DirectoryFileSystem::MkDir(const std::string &dirname)
{
	std::string fullName = GetLocalPath(dirname);

	return File::CreateFullPath(fullName);

}
开发者ID:Myoko,项目名称:ppsspp,代码行数:7,代码来源:DirectoryFileSystem.cpp


示例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,代码来源:DirectoryManager.cpp


示例10: DepotMatchingRepositoryListener

status_t
ServerRepositoryDataUpdateProcess::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,代码来源:ServerRepositoryDataUpdateProcess.cpp


示例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,代码来源:DirectoryFileSystem.cpp


示例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,代码来源:publicfun.cpp


示例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,代码来源:DirectoryFileSystem.cpp


示例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,代码来源:VirtualDiscFileSystem.cpp


示例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,代码来源:templateUtils.c


示例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,代码来源:core.cpp


示例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,代码来源:DirectoryFileSystem.cpp


示例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,代码来源:DirectoryManager.cpp


示例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,代码来源:queue.cpp


示例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,代码来源:queue.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetLocalTime函数代码示例发布时间:2022-05-30
下一篇:
C++ GetLocalOrigin函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap