本文整理汇总了C++中FilePath::Directory方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePath::Directory方法的具体用法?C++ FilePath::Directory怎么用?C++ FilePath::Directory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePath
的用法示例。
在下文中一共展示了FilePath::Directory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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 );
}
}
示例3: InitializeExceptionListener
void Helium::InitializeExceptionListener()
{
// init counting this API seems kind of silly, but we can actually get initialized from several places
if ( ++g_InitCount == 1 )
{
#if HELIUM_OS_WIN
FilePath process ( GetProcessPath() );
// Symbol path always starts with module directory
std::string symbolPath( process.Directory() );
// initialize debug symbols
Helium::InitializeSymbols( symbolPath );
// from here on out, submit crash reports
Helium::EnableExceptionFilter(true);
// wait for an exception
Helium::g_ExceptionOccurred.Set( &HandleException );
#endif
}
}