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


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

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


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

示例1: 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;
}
开发者ID:foolhuang,项目名称:Helium,代码行数:38,代码来源:FileLocations.cpp

示例2: 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

示例3: GetMutableDataDirectory

/// Get the full path to the base directory in which data files are stored.
///
/// @param[out] rbSuccess  True if the path was retrieved successfully, false if not.
///
/// @return  Data directory path, with a trailing path separator character.
static FilePath& GetMutableDataDirectory( bool& rbSuccess )
{
    static FilePath dataDirectory;
    static bool bLocateRequested = false;
    static bool bLocateSuccess = false;

    rbSuccess = bLocateSuccess;

    if( !bLocateRequested )
    {
        bLocateRequested = true;

        // Get the application base directory.
        bool bBaseDirectorySuccess;
        dataDirectory = GetMutableBaseDirectory( bBaseDirectorySuccess );
        if( !bBaseDirectorySuccess )
        {
            dataDirectory.Clear();

            return dataDirectory;
        }

        dataDirectory += TXT( "Data" );
        if( !dataDirectory.Exists() )
        {
            dataDirectory.Clear();

            return dataDirectory;
        }

        dataDirectory += TXT( "/" );
        bLocateSuccess = true;
        rbSuccess = true;
    }

    return dataDirectory;
}
开发者ID:foolhuang,项目名称:Helium,代码行数:42,代码来源:FileLocations.cpp


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