本文整理汇总了C++中FilePath::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePath::Set方法的具体用法?C++ FilePath::Set怎么用?C++ FilePath::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePath
的用法示例。
在下文中一共展示了FilePath::Set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMutableBaseDirectory
/// Get the full path to the base directory of the application.
///
/// @param[out] rbSuccess True if the path was retrieved successfully, false if not.
///
/// @return Application base directory path, with a trailing path separator character.
static FilePath& GetMutableBaseDirectory( bool& rbSuccess )
{
static FilePath baseDirectory;
static bool bLocateRequested = false;
static bool bLocateSuccess = false;
rbSuccess = bLocateSuccess;
if( !bLocateRequested )
{
bLocateRequested = true;
baseDirectory.Set( Helium::GetProcessPath() );
// Strip the executable file.
// Strip the configuration type subdirectory (i.e. Debug, Intermediate, Release, etc.).
// Strip the platform binary subdirectory (i.e. x32, x64).
// Strip the "Bin" directory.
baseDirectory.Set( baseDirectory.Directory() + TXT( "../../.." ) );
if( !baseDirectory.Exists() )
{
baseDirectory.Clear();
return baseDirectory;
}
baseDirectory += TXT( "/" );
bLocateSuccess = true;
rbSuccess = true;
}
return baseDirectory;
}
示例2: subDirectory
/// Get the full path to the base directory in which user data is stored.
///
/// @param[out] rbSuccess True if the path was retrieved successfully, false if not.
///
/// @return User data directory path, with a trailing path separator character.
static FilePath& GetMutableUserDataDirectory( bool& rbSuccess )
{
static FilePath userDataDirectory;
static bool bLocateRequested = false;
static bool bLocateSuccess = false;
rbSuccess = bLocateSuccess;
if( !bLocateRequested )
{
bLocateRequested = true;
tstring gameDataDirectory = Helium::GetAppDataDirectory();
if ( gameDataDirectory.empty() )
{
return userDataDirectory;
}
String subDirectory ( GetProcessName().c_str() );
userDataDirectory.Set( gameDataDirectory + TXT( "/" ) + subDirectory.GetData() );
if( !userDataDirectory.MakePath() )
{
userDataDirectory.Clear();
return userDataDirectory;
}
userDataDirectory += TXT( "/" );
bLocateSuccess = true;
rbSuccess = true;
}
return userDataDirectory;
}
示例3: OnClicked
void FileDialogButtonWidget::OnClicked( const Inspect::FileDialogButtonClickedArgs& args )
{
HELIUM_ASSERT( m_ButtonWindow );
long windowStyle = 0;
switch ( args.m_Type )
{
case Inspect::FileDialogTypes::OpenFile:
windowStyle = wxFD_OPEN;
break;
case Inspect::FileDialogTypes::SaveFile:
windowStyle = wxFD_SAVE;
break;
default:
HELIUM_BREAK();
break;
}
FilePath path;
wxFileDialog fileDialog( m_ButtonWindow->GetParent(), args.m_Caption.c_str(), args.m_StartPath.Directory().c_str(), args.m_StartPath.Filename().c_str(), args.m_Filter.c_str(), windowStyle );
if ( fileDialog.ShowModal() == wxID_OK )
{
path.Set( static_cast<const char*>( fileDialog.GetPath().c_str() ) );
}
args.m_Result = path;
}
示例4: path
TEST(Foundation, FilePath)
{
{
String tempString;
FilePath pathCopy;
FilePath path( TXT( "C:/Users/Test/File.notext.ext" ) );
HELIUM_TRACE( TraceLevels::Info, TXT( "path: %s\n" ), path.c_str() );
pathCopy = path;
tempString = pathCopy.Directory().c_str();
pathCopy.Set( pathCopy.Directory() );
HELIUM_ASSERT( tempString == pathCopy.c_str() );
HELIUM_TRACE( TraceLevels::Info, TXT( "directory name: %s\n" ), *tempString );
pathCopy = path;
tempString = pathCopy.Filename().c_str();
pathCopy.Set( pathCopy.Filename() );
HELIUM_ASSERT( tempString == pathCopy.c_str() );
HELIUM_TRACE( TraceLevels::Info, TXT( "filename: %s\n" ), *tempString );
pathCopy = path;
tempString = pathCopy.Basename().c_str();
pathCopy.Set( pathCopy.Basename() );
HELIUM_ASSERT( tempString == pathCopy.c_str() );
HELIUM_TRACE( TraceLevels::Info, TXT( "base name: %s\n" ), *tempString );
pathCopy = path;
tempString = pathCopy.Extension().c_str();
pathCopy.Set( pathCopy.Extension() );
HELIUM_ASSERT( tempString == pathCopy.c_str() );
HELIUM_TRACE( TraceLevels::Info, TXT( "extension: %s\n" ), *tempString );
}
{
FilePath dataDirectory;
HELIUM_VERIFY( FileLocations::GetDataDirectory( dataDirectory ) );
HELIUM_TRACE( TraceLevels::Debug, TXT( "Data directory: %s\n" ), dataDirectory.c_str() );
HELIUM_UNREF( dataDirectory );
FilePath userDataDirectory;
HELIUM_VERIFY( FileLocations::GetUserDataDirectory( userDataDirectory ) );
HELIUM_TRACE( TraceLevels::Debug, TXT( "User data directory: %s\n" ), userDataDirectory.c_str() );
HELIUM_UNREF( userDataDirectory );
}
}