当前位置: 首页>>代码示例>>C++>>正文


C++ PathName::GetLocation方法代码示例

本文整理汇总了C++中PathName::GetLocation方法的典型用法代码示例。如果您正苦于以下问题:C++ PathName::GetLocation方法的具体用法?C++ PathName::GetLocation怎么用?C++ PathName::GetLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PathName的用法示例。


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

示例1: Init

INT32 LibraryFile::Init(SuperGallery *ParentGal, PathName *APath, SGLibType Type, BOOL Updated, BOOL DoScroll)
{
#ifndef EXCLUDE_GALS
	if(ParentGal == NULL || APath == NULL || !Libraries.IsEmpty())
	{
		ERROR3("LibraryFile::Init - NULL parameters are illegal OR Init called > 1 times");
		if(!Libraries.IsEmpty())
			return(Libraries.GetCount());
		else
			return 0;
	}

	BOOL ok = TRUE;

	// Tidy up Path a bit
	String_256 OurPath(APath->GetPath());
	LibraryFile::TidyUpSubPath(&OurPath);

	// Now point Path to the new pathname
	PathName ModifiedPath(OurPath);
	PathName *Path = &ModifiedPath;

	if(!ModifiedPath.IsValid())
	{
		ERROR3("LibraryFile::Init -> Modified library path is invalid");
		return 0;
	}

	// Remember the pathname and type
	MyPath = *Path;
	MyType = Type;

	ParentGallery = ParentGal;
	if(ParentGallery->IsKindOf(CC_RUNTIME_CLASS(LibraryGallery)))
		ParentLibraryGallery = (LibraryGallery *)ParentGal;
	else
	{
		ERROR3("LibraryFile::Init passed a non-library gallery - yikes...");
		return 0;
	}

	// Need to reset the Quiet status before a stream of Library::Init calls
	ParentLibraryGallery->SetQuietStatus(FALSE);

	BOOL Retry = TRUE;
	while(Retry)
	{
		Retry = FALSE;
	
		// Would be nice to have a way of adding a file to a path in PathName... Is there one ?
		if(!SGLibOil::FileExists(Path))
		{
			// We're opening the font gallery, but can't find the font library path - don't warn
			if(Type == SGLib_Font)
				return 0;

			// tell the user that the directory doesn't exist
			String_256 WarnMsg;
			String_256 DefaultIndex;
			String_256 IndexDesc;
			BOOL CanGenerate;
		
			ok = LibraryFile::GetSubIndexDetails(ParentLibraryGallery, &DefaultIndex, &IndexDesc, &CanGenerate);

			String_256 TmpPath(Path->GetLocation(FALSE));
			LibraryFile::TidyUpSubPath(&TmpPath);

			// Taken out by Graham 30/10/97: If the gallery had no directory specified,
			//we used to throw a warning which said "do you want to specify another folder?"
			//We don't do this any more, because the default is to open all galleries empty and
			//then download stuff from the Xara web site
#if 0 
			WarnMsg.MakeMsg(_R(IDS_BROWSE_OR_SCAN), (TCHAR *)IndexDesc, (TCHAR *)TmpPath);
			Error::SetError(0, WarnMsg, 0);
			INT32 ButtonPressed = InformWarning(0, _R(IDS_BROWSE), _R(IDS_RETRY), _R(IDS_CANCEL)/*, _R(IDS_HELP)*/);
#else	// WEBSTER
			INT32 ButtonPressed = 3;
#endif  // WEBSTER
			TRACEUSER( "Richard", _T("ButtonPressed: %d\n"), ButtonPressed);
			Error::ClearError();
			switch(ButtonPressed)
			{
				case 1:
				{
					// Open the Browse dialog (or the Add.. dialog as it seems to be called now)
					PathName ThePath(*Path);
				
					// This returns FALSE if Cancel was hit, or an error occurred.
 					if(!SGLibOil::GetLibPath(ParentLibraryGallery, &ThePath, CanGenerate, Type))
					{
						ERROR3("GetLibPath returned FALSE in LF::Init");
						return 0;
					}
					else
					{
						ModifiedPath = ThePath;
						if(!ModifiedPath.IsValid())
						{
							ERROR3("LibraryFile::Init -> scanned library path is invalid");
							return 0;
//.........这里部分代码省略.........
开发者ID:vata,项目名称:xarino,代码行数:101,代码来源:sgscanf.cpp

示例2: Do

void OpMenuSave::Do(OpDescriptor* pOpDesc)
{
	//First get the selected document
	Document* pdocToSave=Document::GetSelected();
	CCamDoc* pccamdocToSave = pdocToSave->GetOilDoc();

	if (pdocToSave==NULL || pccamdocToSave==NULL)
	{
		ERROR2RAW("No default document!");
		return;
	}

	//And we'll need a pointer to the application
	Application*		pCamelot = GetApplication();
	CTemplateManager&	TemplateManager( pCamelot->GetTemplateManager() );

	//And put the default templates path in the dialog
	PathName			pathToPutInDialog = TemplateManager.GetTemplatesPath();

	FileUtil::RecursiveCreateDirectory( pathToPutInDialog.GetPath() );
	
	//Now create the dialog
	SaveTemplateDialog	dialogToDisplay(pathToPutInDialog);
		
	//And show it
	if (dialogToDisplay.ShowModal() == wxID_OK)
	{
		//Then get the path they specified, using this amazingly bad, confusing and
		//undocumented file dialog code

		//The "CString" reference should ideally go in Winoil
		PathName pathToSaveTo;
		dialogToDisplay.GetChosenFileName(&pathToSaveTo);

		wxString cstrPathToSaveTo=pathToSaveTo.GetPath(FALSE);
		dialogToDisplay.AppendExtension(&cstrPathToSaveTo);

		String_256 strPathToSaveTo=cstrPathToSaveTo;
		pathToSaveTo=strPathToSaveTo;
						
		// Create the save file.
		CCDiskFile file(pathToSaveTo, ios::out | ios::binary | ios::trunc);

		// First find the filter.
		Filter *pFilter = FindFilter ( FILTERID_NATIVE );

		// Tell it to save attributes.
		pFilter->SetSaveAttributes ( TRUE );

		// Then save the image to the file.
		Save ( pFilter, &file );
		
		//Now, if we should make that path the default path
		if (SaveTemplateDialog::m_fUseAsDefault)
		{
			if (pdocToSave->IsAnimated())
			{
				CTemplateManager::SetDefaultAnimationTemplate( strPathToSaveTo );
			}
			else
			{
				CTemplateManager::SetDefaultDrawingTemplate( strPathToSaveTo );
			}
		}

		if (SaveTemplateDialog::m_fDefaultTemplatesFolder)
		{
			String_256	strDefaultPath = pathToSaveTo.GetLocation( TRUE );
			CTemplateManager::SetTemplatesPath( strDefaultPath );
		}
	}

	// Finished the operation
	End();
}
开发者ID:vata,项目名称:xarino,代码行数:75,代码来源:nativeop.cpp


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