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


C++ FilePath::Directory方法代码示例

本文整理汇总了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;
}
开发者ID:foolhuang,项目名称:Helium,代码行数:39,代码来源:FileLocations.cpp

示例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 );
    }

}
开发者ID:KETMGaming,项目名称:Helium,代码行数:46,代码来源:GTest_Misc.cpp

示例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
	}
}
开发者ID:Fantasticer,项目名称:Helium,代码行数:22,代码来源:ExceptionReport.cpp


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