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

C++ VFilePath类代码示例

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

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



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

示例1: RetainFolder

VFolder* VRIAServerSolution::RetainFolder() const
{
	VFolder *folder = NULL;

	if (fDesignSolution != NULL)
	{
		VProjectItem *item = fDesignSolution->GetSolutionFileProjectItem();
		if (item != NULL)
		{
			VFilePath path;
			item->GetFilePath( path);
			path = path.ToFolder();
			if (path.IsFolder())
			{
				folder = new VFolder( path);
				if (folder != NULL && !folder->Exists())
				{
					folder->Release();
					folder = NULL;
				}
			}
		}
	}	
	return folder;
}
开发者ID:rajeshpillai,项目名称:core-Wakanda,代码行数:25,代码来源:VRIAServerSolution.cpp


示例2: Instantiate

VProjectItem* VProjectItemFile::Instantiate( const XBOX::VURL& inURL, VProjectItem *inParent, bool inExternalReference)
{
	VProjectItem *result = NULL;

	VFilePath path;
	if (inURL.GetFilePath( path))
	{
		if (path.IsFile())
		{
			VString fileName;
			path.GetFileName( fileName);

			VProjectItemFile *behaviour = new VProjectItemFile( NULL);
			if (behaviour != NULL)
			{
				result = new VProjectItem( behaviour);
				if (result != NULL)
				{
					result->SetURL( inURL);
					result->SetName( fileName);
					result->SetDisplayName( fileName);
					result->SetExternalReference( inExternalReference);

					if (inParent != NULL)
						inParent->AttachChild( result);
				}
			}
		}
	}
	return result;
}
开发者ID:sanyaade-mobiledev,项目名称:core-Wakanda,代码行数:31,代码来源:VProjectItemBehaviour.cpp


示例3: VFile

VFile* XLinuxLibrary::RetainExecutableFile(const VFilePath &inFilePath) const
{
    //jmo - What are we supposed to retain ? First we try the exact path...

	if(inFilePath.IsFile())
		return new VFile(inFilePath);

    //jmo - If exact path doesn't work, we assume inFilePath to be part of a bundle
    //      and try to find the corresponding shared object.
    
    VFilePath bundlePath=inFilePath;

    while(!bundlePath.MatchExtension(CVSTR("bundle"), true /*case sensitive*/) && bundlePath.IsValid())
        bundlePath=bundlePath.ToParent();

    if(!bundlePath.IsValid())
        return NULL;

    VString name;
    bundlePath.GetFolderName(name, false /*no ext.*/);

    if(name.IsEmpty())
        return NULL;

    VString soSubPath=CVSTR("Contents/Linux/")+VString(name)+CVSTR(".so");

    VFilePath soPath;
    soPath.FromRelativePath(bundlePath, soSubPath, FPS_POSIX);
            
    if(soPath.IsFile())
        return new VFile(soPath);
    
    return NULL;
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:34,代码来源:XLinuxLibrary.cpp


示例4: file

/*
	static
*/
VError VFolder::ResolveAliasFolder( VFolder **ioFolder, bool inDeleteInvalidAlias)
{
	VError err = VE_OK;
	if ( (*ioFolder != NULL) && (*ioFolder)->fPath.IsFolder() && !(*ioFolder)->fFolder.Exists( false /* doesn't check alias */) )
	{
		// the folder doesn't exists
		// maybe is it an alias file?
		VString path = (*ioFolder)->fPath.GetPath();
		if (testAssert( path[path.GetLength()-1] == FOLDER_SEPARATOR))
		{
			path.Truncate( path.GetLength()-1);
			#if VERSIONWIN
			path += ".lnk";
			#endif
			VFile file( path);
			if (file.IsAliasFile() && file.Exists())
			{
				VFilePath resolvedPath;
				err = file.GetImpl()->ResolveAlias( resolvedPath);	// nothrow
				if (err == VE_OK)
				{
					if (resolvedPath.IsFolder())
					{
						(*ioFolder)->Release();
						*ioFolder = new VFolder( resolvedPath);
					}
					else if (inDeleteInvalidAlias)
					{
						err = file.Delete();
					}
					else
					{
						StThrowFileError errThrow( *ioFolder, VE_FILE_CANNOT_RESOLVE_ALIAS_TO_FOLDER);
						err = errThrow.GetError();
					}
				}
				else if (inDeleteInvalidAlias)
				{
					err = file.Delete();
				}
				else
				{
					if (IS_NATIVE_VERROR( err))
					{
						StThrowFileError errThrow( &file, VE_FILE_CANNOT_RESOLVE_ALIAS, err);
						err = errThrow.GetError();
					}
				}
			}
		}
	}
	return err;
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:56,代码来源:VFolder.cpp


示例5: RetainFolder

VFolder* VProjectItemFolder::RetainFolder() const
{
	VFolder *folder = NULL;

	if (fOwner != NULL)
	{
		VFilePath path;
		if (fOwner->GetFilePath( path) && path.IsFolder())
			folder = new VFolder( path);
	}
	return folder;
}
开发者ID:sanyaade-mobiledev,项目名称:core-Wakanda,代码行数:12,代码来源:VProjectItemBehaviour.cpp


示例6: RetainFile

VFile* VProjectItemFile::RetainFile() const
{
	VFile *file = NULL;

	if (fOwner != NULL)
	{
		VFilePath path;
		if (fOwner->GetFilePath( path) && path.IsFile())
			file = new VFile( path);
	}
	return file;
}
开发者ID:sanyaade-mobiledev,项目名称:core-Wakanda,代码行数:12,代码来源:VProjectItemBehaviour.cpp


示例7: GetExecutableFilePath

VFilePath VProcess::GetExecutableFilePath() const
{
	VFilePath filePath;

#if VERSIONMAC

	CFURLRef exeURL = ::CFBundleCopyExecutableURL( ::CFBundleGetMainBundle());
	
	if (testAssert( exeURL != NULL ))
	{
		CFStringRef cfPath = ::CFURLCopyFileSystemPath( exeURL, kCFURLHFSPathStyle);
		if (testAssert( cfPath != NULL ))
		{
			VString thepath;
			thepath.MAC_FromCFString( cfPath);
			thepath.Compose();
			filePath.FromFullPath( thepath, FPS_SYSTEM);
			::CFRelease( cfPath);
		}
		
		::CFRelease(exeURL );
	}

#elif VERSIONWIN

	// Get a path to the exe.
	UniChar path[4096];
	DWORD pathLength=0;

	path[sizeof(path)/sizeof(UniChar)-2]=0;
	pathLength = ::GetModuleFileNameW(NULL, path, sizeof(path));
	
	if (testAssert(pathLength != 0 && !path[sizeof(path)/sizeof(UniChar)-2]))
	{
		VString thepath( path);
		filePath.FromFullPath( thepath, FPS_SYSTEM);
	}

#elif VERSION_LINUX

	PathBuffer path;

	VError verr=path.InitWithExe();
	xbox_assert(verr==VE_OK);

	path.ToPath(&filePath);
	xbox_assert(verr==VE_OK);
		
#endif
	
	return filePath;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:52,代码来源:VProcess.cpp


示例8: _AddFile

VError VArchiveStream::_AddFile(VFile& inFile,const VFilePath& inSourceFolder,const VString& inExtraInfo)
{
	XBOX::VError result = VE_FILE_NOT_FOUND;
	if ( inFile.Exists() )
	{
		///ACI0078887, O.R. Nov 29th 2012: mask error if file is already known, does no harm 
		result = VE_OK;
		if (!ContainsFile( &inFile))
		{
			VString relativePath;
			if(testAssert(!inSourceFolder.IsEmpty() && inFile.GetPath().GetRelativePath(inSourceFolder,relativePath)))
			{
				fUniqueFilesCollection->insert(inFile.GetPath());
				fFileExtra.push_back( inExtraInfo );
				fFileList.push_back( &inFile );
				fSourceFolderForFiles.push_back(inSourceFolder);	
			}
			else
			{
				///ACI0078887, O.R. Nov 29th 2012: explicitely fail if item is not relative to source folder, this should never happen
				result = VE_INVALID_PARAMETER;
			}
		}
	}
	return result;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:26,代码来源:VArchiveStream.cpp


示例9: IsSameFile

bool VLibrary::IsSameFile(const VFilePath &inLibFile) const
{
	VTaskLock	locker(&fCriticalSection);

	bool result = (fFilePath.GetPath().CompareToString(inLibFile.GetPath()) == CR_EQUAL);
	
	return result;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:8,代码来源:VLibrary.cpp


示例10: Load

Boolean XWinLibrary::Load( const VFilePath &inPath)
{
	VFilePath executablePath;
	if (_BuildExecutablePath( inPath, executablePath))
	{
		fInstance = ::LoadLibraryExW( executablePath.GetPath().GetCPointer(), NULL, 0);
	}
	
	if (fInstance == NULL)
	{
		XBOX::VString path( executablePath.GetPath());
		DebugMsg("VComponentManager erreur load %V\n", &path);
		StThrowFileError throwErr( inPath, VE_LIBRARY_CANNOT_LOAD, ::GetLastError());
		fInstance = NULL;
	}
	
	return fInstance != NULL;
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:18,代码来源:XWinLibrary.cpp


示例11: VFile

VFile* XLinuxFileIterator::XLinuxFileIterator::Next()
{
	PathBuffer path;
	PathBuffer* pathPtr=fIt->Next(&path, fOpts);

	if(pathPtr==NULL)
		return NULL;

	VFilePath tmpPath;
	pathPtr->ToPath(&tmpPath);

	VFile *file;
	if ( (fFileSystem == NULL) || tmpPath.IsChildOf( fFileSystem->GetRoot()) )
		file = new VFile(tmpPath, fFileSystem);
	else
		file = NULL;

	return file;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:19,代码来源:XLinuxFile.cpp


示例12: DebugTest

void VMacResFile::DebugTest()
{
	// look for a "test.rsrc" file in same folder as the app
	// and duplicate it
	VFilePath sourcePath = VProcess::Get()->GetExecutableFolderPath();
	sourcePath.SetFileName(VStr63("test.rsrc"));
	
	DebugMsg("Looking for file = %V\n", &sourcePath);
	
	VMacResFile srcFile(sourcePath, FA_READ, false);

	sourcePath.SetFileName(VStr63("test copy.rsrc"));
	VMacResFile dstFile(sourcePath, FA_READ_WRITE, true);

	VError error = srcFile.CopyResourcesInto(dstFile);

	dstFile.Close();
	srcFile.Close();
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:19,代码来源:XMacResource.cpp


示例13: VRIAJSCallbackGlobalFunction

VJSRequestHandler* VRPCService::_CreateRequestHandlerForMethods()
{
	// TBD: use a module function handler instead of a global function handler
	VRIAJSCallbackGlobalFunction *callback = new VRIAJSCallbackGlobalFunction( L"doRequest");
	VJSRequestHandler *handler = new VJSRequestHandler( fApplication, fPatternForMethods, callback);
	if (handler != NULL)
	{
		handler->SetEnable( true);

		VFilePath rpcImpl;
		VRIAServerApplication::Get()->GetWAFrameworkFolderPath( rpcImpl);
		rpcImpl.ToSubFolder( L"Core").ToSubFolder( L"Runtime").ToSubFolder( L"rpcService");
		rpcImpl.SetFileName( L"rpc-server.js", true);

		VFile *file = new VFile( rpcImpl);
		handler->RegisterIncludedFile( file);
		QuickReleaseRefCountable( file);
	}
	return handler;
}
开发者ID:StephaneH,项目名称:core-Wakanda,代码行数:20,代码来源:VRPCService.cpp


示例14: RetainLogFolder

VFolder* VRIAServerSolution::RetainLogFolder( bool inCreateIfNotExists) const
{
	VFolder *folder = NULL;

	if (fDesignSolution != NULL)
	{
		VProjectItem *item = fDesignSolution->GetSolutionFileProjectItem();
		if (item != NULL)
		{
			VFilePath path;
			item->GetFilePath( path);
			path = path.ToFolder();
			path.ToSubFolder( L"Logs");
			folder = new VFolder( path);
			if (folder != NULL && !folder->Exists() && inCreateIfNotExists)
				folder->Create();
		}
	}
	return folder;
}
开发者ID:rajeshpillai,项目名称:core-Wakanda,代码行数:20,代码来源:VRIAServerSolution.cpp


示例15: _Open

VError VMacResFile::_Open(const VFilePath& inPath, FileAccess inFileAccess, Boolean inCreate)
{
	if (!testAssert(fRefNum == -1))
		return VE_STREAM_ALREADY_OPENED;
	
	assert(fLastStringList == NULL);
	
	fCloseFile = true;
	
	sWORD	curres = ::CurResFile();
	
	FSSpec spec;
	VString fullPath;
	inPath.GetPath(fullPath);
	Boolean isOk = XMacFile::HFSPathToFSSpec(fullPath, &spec) == noErr;

	SignedByte permission = fsCurPerm;
	switch(inFileAccess)
	{
		case FA_READ:	permission = fsRdPerm; break;
		case FA_READ_WRITE:	permission = fsWrPerm; break;
		case FA_SHARED:	permission = fsRdWrShPerm; break;
	}

	if (!isOk && inCreate)
		::FSpCreateResFile(&spec, '????', '????', smSystemScript);

	// the resource file for component is private so... open it as orphan (m.c)
	OSErr err = ::FSpOpenOrphanResFile(&spec, permission,&fRefNum);

	if (fRefNum == -1 && inCreate)
	{
		// L.E. 17/02/00 le fichier peut exister mais sans res fork
		// pas FSpCreateResFile car on veut conserver type et createur
		::HCreateResFile(spec.vRefNum, spec.parID, spec.name);
		::FSpOpenOrphanResFile(&spec, permission,&fRefNum);
	}
	
	OSErr macError = ::ResError();
	
	::UseResFile(curres);

	assert(fRefNum != -1);

	if (fRefNum == -1)
		fReadOnly = true;
	else
	{
		sWORD	flags = ::GetResFileAttrs(fRefNum);
		fReadOnly = (inFileAccess == FA_READ) || ((flags & mapReadOnly) != 0);
	}
	
	return VErrorBase::NativeErrorToVError((VNativeError)macError);
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:54,代码来源:XMacResource.cpp


示例16: ConformsTo

bool VProjectItemFile::ConformsTo( const VString& inFileKindID) const
{
	bool result = false, done = false;

	if (fOwner != NULL)
	{
	#if 0	// sc 08/09/2011, optimization
		VFilePath path;
		if (fOwner->GetFilePath( path) && path.IsFile())
		{
			VFile file( path);
			if (file.Exists())
			{
				result = file.ConformsTo( inFileKindID);
				done = true;
			}
		}
	#endif

		if (!done)
		{
			VString extension;
			fOwner->GetExtension( extension);

			VFileKind *itemKind = VFileKindManager::Get()->RetainFirstFileKindMatchingWithExtension( extension);
			if (itemKind != NULL)
			{
				VFileKind *refKind = VFileKindManager::Get()->RetainFileKind( inFileKindID);
				if (refKind != NULL)
				{
					result = itemKind->ConformsTo( *refKind);
					ReleaseRefCountable( &refKind);
				}
				ReleaseRefCountable( &itemKind);
			}
		}
	}

	return result;
}
开发者ID:sanyaade-mobiledev,项目名称:core-Wakanda,代码行数:40,代码来源:VProjectItemBehaviour.cpp


示例17: _BuildExecutablePath

static bool _BuildExecutablePath( const VFilePath &inPath, VFilePath& outExecutablePath)
{
	bool ok;
	if (inPath.IsFile())
	{
		outExecutablePath = inPath;
		ok = true;
	}
	else if (inPath.IsFolder())
	{
		// if path is a folder named truc.someextension,
		// look at truc.someextension\Contents\Windows\truc.dll
		
		// afabre : finally, we look the dll near the exe file
		VString name;
		inPath.GetName( name);
		outExecutablePath = inPath;
		outExecutablePath = outExecutablePath.ToParent().ToParent();
		outExecutablePath.SetFileName( name);
		outExecutablePath.SetExtension( CVSTR( "dll"));
		ok = true;
	}
	else
	{
		ok = false;
	}

	return ok;
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:29,代码来源:XWinLibrary.cpp


示例18: switch

VFolder* XWinLibrary::RetainFolder(const VFilePath &inPath, BundleFolderKind inKind) const
{
	VFolder *folder = NULL;
	if (inPath.IsFile())
	{
		switch( inKind)
		{
			case kBF_BUNDLE_FOLDER:					// The folder hosting the bundle
			case kBF_EXECUTABLE_FOLDER:				// The folder of executable file (platform related)
				{
					VFilePath parent = inPath;
					folder = new VFolder( parent.ToParent());
				}

			default:
				assert( false);
				break;
		}
	}
	else if (inPath.IsFolder())
	{
		switch( inKind)
		{
			case kBF_BUNDLE_FOLDER:					// The folder hosting the bundle
				{
					VFilePath parent = inPath;
					folder = new VFolder( parent/*.ToParent()*/);
					break;
				}

			case kBF_EXECUTABLE_FOLDER:				// The folder of executable file (platform related)
				{
					VFilePath executablePath;
					if (_BuildExecutablePath( inPath, executablePath))
					{
						folder = new VFolder( executablePath.ToFolder());
					}
					break;
				}

			case kBF_RESOURCES_FOLDER:				// The folder of main resources
				{
					VFilePath path = inPath;
					path.ToSubFolder( CVSTR("Contents")).ToSubFolder( CVSTR( "Resources"));
					folder = new VFolder( path);
					break;
				}

			case kBF_LOCALISED_RESOURCES_FOLDER:	// The folder of prefered localization
			case kBF_PLUGINS_FOLDER:				// The folder for bundle's plugins
			case kBF_PRIVATE_FRAMEWORKS_FOLDER:		// The folder for private frameworks
			case kBF_PRIVATE_SUPPORT_FOLDER:		// The folder for private support files
			default:
				assert( false);
				break;
		}
	}
	return folder;
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:59,代码来源:XWinLibrary.cpp


示例19: SearchExecutablePath

bool XMacSystem::SearchExecutablePath( const VString& inExecutableName, VFilePath& outPath)
{
	// first lookup in environment variables
	bool found = XBSDSystem::SearchExecutablePath( inExecutableName, outPath);
	
	// then ask launch services
	if (!found)
	{
		VString name( inExecutableName);
		
		if (!name.EndsWith( CVSTR( ".app")))
			name += CVSTR( ".app");
		
		CFURLRef cfAppUrl = NULL;
		CFStringRef cfName = name.MAC_RetainCFStringCopy();
		OSStatus status = LSFindApplicationForInfo( kLSUnknownCreator, NULL /* inBundleID */, cfName, NULL /* outFSRef */, &cfAppUrl);
		if (cfName != NULL)
			CFRelease( cfName);
			
		if (status == noErr)
		{
			if (testAssert( cfAppUrl != NULL))
			{
				CFStringRef cfPosixPath = ::CFURLCopyFileSystemPath( cfAppUrl, kCFURLPOSIXPathStyle);
				if (testAssert( cfPosixPath != NULL))
				{
					VString posixPath;
					posixPath.MAC_FromCFString( cfPosixPath);
					
					posixPath.Compose();
					
					// add an ending / because it's a bundle folder
					posixPath += "/";
					outPath.FromFullPath( posixPath, FPS_POSIX);
					
					found = true;
					::CFRelease( cfPosixPath);
				}
			}
		}

		if (cfAppUrl != NULL)
			CFRelease( cfAppUrl);
	}
	
	return found;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:47,代码来源:XMacSystem.cpp


示例20: VFolder

VFolder *XWinFolderIterator::_GetPath( const VString& inFileName, DWORD inAttributes)
{
	VFolder *path = NULL;
	if (inFileName[0] != CHAR_FULL_STOP)
	{
		bool isInvisible = (inAttributes & FILE_ATTRIBUTE_HIDDEN) ? true : false;
		bool isFolder = (inAttributes & FILE_ATTRIBUTE_DIRECTORY) ? true : false;
		if (!isInvisible || (fOptions & FI_WANT_INVISIBLES))
		{
			if (isFolder)
			{
				if (fOptions & FI_WANT_FOLDERS)
				{
					VFilePath currentPath;
					currentPath.FromFilePath( fRootPath);
					currentPath.ToSubFolder( inFileName);
					path = new VFolder(currentPath);
				}
			}
			else
			{
				// it's a file, maybe it's an alias to a folder
				if (fOptions & FI_RESOLVE_ALIASES)
				{
					VFilePath currentPath;
					currentPath.FromFilePath( fRootPath);
					currentPath.SetFileName( inFileName);
					VFile theFile( currentPath);
					if (theFile.IsAliasFile())
					{
						VFilePath resolvedPath;
						if ( (theFile.ResolveAlias( resolvedPath) == VE_OK) && resolvedPath.IsFolder())
							path = new VFolder( resolvedPath);
					}
				}
			}
		}
	}
	return path;
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:40,代码来源:XWinFolder.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ VFolder类代码示例发布时间:2022-05-31
下一篇:
C++ VFile类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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