當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetLocalPath函數代碼示例

本文整理匯總了C++中GetLocalPath函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetLocalPath函數的具體用法?C++ GetLocalPath怎麽用?C++ GetLocalPath使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetLocalPath函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的GetLocalPath函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。