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


C++ FileSystem::DirExists方法代码示例

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


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

示例1: BuildClean

bool BuildBase::BuildClean(const String& path)
{
    if (buildFailed_)
    {
        LOGERRORF("BuildBase::BuildClean - Attempt to clean directory of failed build, %s", path.CString());
        return false;
    }

    FileSystem* fileSystem = GetSubsystem<FileSystem>();

    if (!fileSystem->DirExists(path))
        return true;

    // On Windows, do a little dance with the folder to avoid issues
    // with deleting folder and immediately recreating it

    String pathName, fileName, ext;
    SplitPath(path, pathName, fileName, ext);
    pathName = AddTrailingSlash(pathName);    

    unsigned i = 0;
    while (true) 
    {
        String newPath = ToString("%s%s_Temp_%u", pathName.CString(), fileName.CString(), i++);
        if (!fileSystem->DirExists(newPath))
        {
            if (!MoveFileExW(GetWideNativePath(path).CString(), GetWideNativePath(newPath).CString(), MOVEFILE_WRITE_THROUGH))
            {
                FailBuild(ToString("BuildBase::BuildClean: Unable to move directory %s -> ", path.CString(), newPath.CString()));
                return false;
            }

            // Remove the moved directory
            return BuildRemoveDirectory(newPath);

        }
        else
        {
            LOGWARNINGF("BuildBase::BuildClean - temp build folder exists, removing: %s", newPath.CString());
            fileSystem->RemoveDir(newPath, true);
        }

        if (i == 255)
        {
            FailBuild(ToString("BuildBase::BuildClean: Unable to move directory ( i == 255) %s -> ", path.CString(), newPath.CString()));
            return false;
        }
    }

    return false;
}
开发者ID:GREYFOXRGR,项目名称:AtomicGameEngine,代码行数:51,代码来源:BuildBase.cpp

示例2: GenerateStringXML

bool AndroidProjectGenerator::GenerateStringXML()
{
    FileSystem* fs = GetSubsystem<FileSystem>();
    ToolSystem* toolSystem = GetSubsystem<ToolSystem>();
    Project* project = toolSystem->GetProject();
    AndroidBuildSettings* settings = project->GetBuildSettings()->GetAndroidBuildSettings();

    String appName = settings->GetAppName();

    if (!appName.Length())
    {
        errorText_ = "Invalid App Name, select the App Name in Build Settings.";
        return false;
    }

    String strings  = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";

    strings += "<resources>\n";

    strings.AppendWithFormat("<string name=\"app_name\">%s</string>\n", appName.CString());

    strings += "</resources>\n";
    
    // Create res/values if it doesn't exist
    if (!fs->DirExists(buildPath_ + "/res/values"))
    {
        fs->CreateDirsRecursive(buildPath_ + "/res/values");
    }
    
    // Check that we successfully created it
    if (!fs->DirExists(buildPath_ + "/res/values"))
    {
        errorText_ = "Unable to create directory: " + buildPath_ + "/res/values";
        return false;
    }
    
    File file(context_, buildPath_ + "/res/values/strings.xml", FILE_WRITE);

    if (!file.IsOpen())
    {
        errorText_ = "Unable to write: " + buildPath_ + "/res/values/strings.xml";
        return false;
    }

    file.Write(strings.CString(), strings.Length());

    return true;

}
开发者ID:LumaDigital,项目名称:AtomicGameEngine,代码行数:49,代码来源:AndroidProjectGenerator.cpp

示例3: SaveLicense

void LicenseSystem::SaveLicense()
{
    FileSystem* filesystem = GetSubsystem<FileSystem>();
    String licenseFilePath = filesystem->GetAppPreferencesDir("AtomicEditor", "License");
    licenseFilePath = AddTrailingSlash(licenseFilePath);

    if (!filesystem->DirExists(licenseFilePath))
    {
        Poco::File dirs(licenseFilePath.CString());
        dirs.createDirectories();
    }

    licenseFilePath += "AtomicLicense";

    SharedPtr<File> file(new File(context_, licenseFilePath, FILE_WRITE));
    file->WriteInt(1); // version
    file->WriteString(key_);

    file->WriteBool(licenseWindows_);
    file->WriteBool(licenseMac_);
    file->WriteBool(licenseAndroid_);
    file->WriteBool(licenseIOS_);
    file->WriteBool(licenseHTML5_);
    file->WriteBool(licenseModule3D_);

    file->Close();

}
开发者ID:ezhangle,项目名称:AtomicGameEngine,代码行数:28,代码来源:AELicenseSystem.cpp

示例4: dirs

LicenseSystem::LicenseSystem(Context* context) :
    Object(context)
    , eulaAgreementConfirmed_(false)

{
    FileSystem* filesystem = GetSubsystem<FileSystem>();

    licenseFilePath_ = filesystem->GetAppPreferencesDir("AtomicEditor", "License");
    licenseFilePath_ = AddTrailingSlash(licenseFilePath_);

    if (!filesystem->DirExists(licenseFilePath_))
    {
        Poco::File dirs(licenseFilePath_.CString());
        dirs.createDirectories();
    }

    licenseCachePath_ = licenseFilePath_;

    licenseCachePath_ += "AtomicLicenseCache";

    licenseFilePath_ += "AtomicLicense";

    eulaAgreementPath_ = filesystem->GetAppPreferencesDir("AtomicEditor", "License");
    eulaAgreementPath_ = AddTrailingSlash(eulaAgreementPath_);
    eulaAgreementPath_ += "EulaConfirmed";

    ResetLicense();
}
开发者ID:EternalXY,项目名称:AtomicGameEngine,代码行数:28,代码来源:LicenseSystem.cpp

示例5: PruneOrphanedDotAssetFiles

void AssetDatabase::PruneOrphanedDotAssetFiles()
{

    if (project_.Null())
    {
        LOGDEBUG("AssetDatabase::PruneOrphanedDotAssetFiles - called without project loaded");
        return;
    }

    FileSystem* fs = GetSubsystem<FileSystem>();

    const String& resourcePath = project_->GetResourcePath();

    Vector<String> allResults;

    fs->ScanDir(allResults, resourcePath, "*.asset", SCAN_FILES, true);

    for (unsigned i = 0; i < allResults.Size(); i++)
    {
        String dotAssetFilename = resourcePath + allResults[i];
        String assetFilename = ReplaceExtension(dotAssetFilename, "");

        // remove orphaned asset files
        if (!fs->FileExists(assetFilename) && !fs->DirExists(assetFilename))
        {

            LOGINFOF("Removing orphaned asset file: %s", dotAssetFilename.CString());
            fs->Delete(dotAssetFilename);
        }

    }
}
开发者ID:nonconforme,项目名称:AtomicGameEngine,代码行数:32,代码来源:AssetDatabase.cpp

示例6: InitPaths

bool CubemapGenerator::InitPaths()
{

    String scenePath = sceneEditor_->GetFullPath();

    String pathName;
    String fileName;
    String ext;

    SplitPath(scenePath, pathName, fileName, ext);

    outputPathAbsolute_ = pathName + "Cubemaps/" + fileName + "/";

    FileSystem* fileSystem = GetSubsystem<FileSystem>();

    if (!fileSystem->DirExists(outputPathAbsolute_))
    {
        if (!fileSystem->CreateDirs(pathName,  "Cubemaps/" + fileName + "/"))
        {
            LOGERRORF("CubemapGenerator::InitRender - Unable to create path: %s", outputPathAbsolute_.CString());
            return false;
        }
    }

    // TODO: There should be a better way of getting the resource path
    ToolSystem* tsystem = GetSubsystem<ToolSystem>();
    Project* project = tsystem->GetProject();

    resourcePath_ = outputPathAbsolute_;
    resourcePath_.Replace(project->GetResourcePath(), "");
    resourcePath_ = AddTrailingSlash(resourcePath_);

    return true;

}
开发者ID:GREYFOXRGR,项目名称:AtomicGameEngine,代码行数:35,代码来源:CubemapGenerator.cpp

示例7: HandleNewFolder

void ResourceOps::HandleNewFolder(const String& resourcePath, bool reportError)
{
    Editor* editor = GetSubsystem<Editor>();
    FileSystem* fs = GetSubsystem<FileSystem>();

    if (fs->DirExists(resourcePath) || fs->FileExists(resourcePath))
    {
        if (reportError)
        {
            String errorMsg;
            errorMsg.AppendWithFormat("Already exists:\n\n %s", resourcePath.CString());
            editor->PostModalError("New Folder Error", errorMsg);
        }

        return;
    }

    if (!fs->CreateDir(resourcePath))
    {
        if (reportError)
        {
            String errorMsg;
            errorMsg.AppendWithFormat("Could not create:\n\n %s", resourcePath.CString());
            editor->PostModalError("New Folder Error", errorMsg);
        }

        return;
    }

    // file watcher doesn't currently handle subdir
    GetSubsystem<MainFrame>()->GetProjectFrame()->Refresh();

}
开发者ID:gitter-badger,项目名称:Clockwork,代码行数:33,代码来源:CEResourceOps.cpp

示例8: DeleteAsset

void AssetDatabase::DeleteAsset(Asset* asset)
{
    SharedPtr<Asset> assetPtr(asset);

    List<SharedPtr<Asset>>::Iterator itr = assets_.Find(assetPtr);

    if (itr == assets_.End())
        return;

    assets_.Erase(itr);

    const String& resourcePath = asset->GetPath();

    FileSystem* fs = GetSubsystem<FileSystem>();

    if (fs->DirExists(resourcePath))
    {
        fs->RemoveDir(resourcePath, true);
    }
    else if (fs->FileExists(resourcePath))
    {
        fs->Delete(resourcePath);
    }

    String dotAsset = resourcePath + ".asset";

    if (fs->FileExists(dotAsset))
    {
        fs->Delete(dotAsset);
    }

    VariantMap eventData;
    eventData[ResourceRemoved::P_GUID] = asset->GetGUID();
    SendEvent(E_RESOURCEREMOVED, eventData);
}
开发者ID:nonconforme,项目名称:AtomicGameEngine,代码行数:35,代码来源:AssetDatabase.cpp

示例9: Setup

    void AtomicGlowApp::Setup()
    {
        IPCClientApp::Setup();

        // AtomicGlow is always headless
        engineParameters_["Headless"] = true;

        FileSystem* filesystem = GetSubsystem<FileSystem>();
        engineParameters_.InsertNew("LogName", filesystem->GetAppPreferencesDir("AtomicEditor", "Logs") + "AtomicGlow.log");

        ToolSystem* tsystem = new ToolSystem(context_);
        context_->RegisterSubsystem(tsystem);

        ToolEnvironment* env = new ToolEnvironment(context_);
        context_->RegisterSubsystem(env);

        String projectPath;

        for (unsigned i = 0; i < arguments_.Size(); ++i)
        {
            if (arguments_[i].Length() > 1)
            {
                String argument = arguments_[i].ToLower();
                String value = i + 1 < arguments_.Size() ? arguments_[i + 1] : String::EMPTY;

                if (argument == "--project" && value.Length())
                {
                    if (GetExtension(value) == ".atomic")
                    {
                        value = GetPath(value);
                    }

                    if (filesystem->DirExists(value))
                    {

                    }
                    else
                    {
                        ErrorExit(ToString("%s project path does not exist", value.CString()));
                    }

                    projectPath = AddTrailingSlash(value);

                }
            }
        }

        if (!env->Initialize())
        {

			ErrorExit("Unable to initialize tool environment from %s");

            return;
        }

        engineParameters_["ResourcePrefixPaths"] = env->GetRootSourceDir() + "/Resources/";
        engineParameters_["ResourcePaths"] = ToString("CoreData;EditorData;%sResources;%sCache", projectPath.CString(), projectPath.CString());


    }
开发者ID:dragonCASTjosh,项目名称:AtomicGameEngine,代码行数:60,代码来源:AtomicGlowApp.cpp

示例10: Build

void BuildIOS::Build(const String& buildPath)
{
    buildPath_ = buildPath + "/IOS-Build";

    Initialize();

    FileSystem* fileSystem = GetSubsystem<FileSystem>();
    if (fileSystem->DirExists(buildPath_))
        fileSystem->RemoveDir(buildPath_, true);


 #ifdef ATOMIC_PLATFORM_WINDOWS
    String buildSourceDir = fileSystem->GetProgramDir();
 #else
    String buildSourceDir = fileSystem->GetAppBundleResourceFolder();
 #endif

    String buildAppSourceDir = buildSourceDir + "Deployment/IOS/AtomicPlayer.app";

    fileSystem->CreateDir(buildPath_);

    String buildDestDist = buildPath_ + "/AtomicPlayer.app";

    fileSystem->CreateDir(buildDestDist);

    String resourcePackagePath = buildDestDist + "/AtomicResources.pak";
    GenerateResourcePackage(resourcePackagePath);

    fileSystem->Copy(buildAppSourceDir + "/AtomicPlayer", buildDestDist + "/AtomicPlayer");
    fileSystem->Copy(buildAppSourceDir + "/PkgInfo", buildDestDist + "/PkgInfo");

    BuildSystem* buildSystem = GetSubsystem<BuildSystem>();

    IOSBuildSettings settings = buildSystem->GetBuildSettings()->GetIOSSettings();

    fileSystem->Copy(settings.provisionFile, buildDestDist + "/embedded.mobileprovision");

    String entitlements = GenerateEntitlements();
    String plist = GenerateInfoPlist();

    File file(context_, buildPath_ + "/AtomicPlayer.app.xcent", FILE_WRITE);

    if (file.IsOpen())
    {
        file.Write(entitlements.CString(), entitlements.Length());
        file.Close();
    }

    File pfile(context_, buildDestDist + "/Info.plist", FILE_WRITE);

    if (pfile.IsOpen())
    {
        pfile.Write(plist.CString(), plist.Length());
        pfile.Close();
    }

    RunConvertPList();

}
开发者ID:AliAkbarMontazeri,项目名称:AtomicGameEngine,代码行数:59,代码来源:BuildIOS.cpp

示例11: Import

void AssetDatabase::Import(const String& path)
{
    FileSystem* fs = GetSubsystem<FileSystem>();

    // nothing for now
    if (fs->DirExists(path))
        return;
}
开发者ID:nonconforme,项目名称:AtomicGameEngine,代码行数:8,代码来源:AssetDatabase.cpp

示例12: LoadSahders

void ShaderCompiler::LoadSahders()
{
	FileSystem* fileSystem = new FileSystem(context_);
	if(!fileSystem->DirExists("../Shaders"))
		fileSystem->CreateDir("../Shaders");

	
}
开发者ID:dragonCASTjosh,项目名称:Clockwork,代码行数:8,代码来源:ShaderCompiler.cpp

示例13: RevealInFinder

void FileUtils::RevealInFinder(const String& fullpath)
{
    FileSystem* fs = GetSubsystem<FileSystem>();
    if (fs->DirExists(fullpath))
        fs->SystemOpen(fullpath);
    else if (fs->FileExists(fullpath))
        fs->SystemOpen(GetPath(fullpath));
}
开发者ID:abandonrules,项目名称:AtomicGameEngine,代码行数:8,代码来源:FileUtils.cpp

示例14: SaveByteCode

void ShaderVariation::SaveByteCode(const String& binaryShaderName)
{
    ResourceCache* cache = owner_->GetSubsystem<ResourceCache>();
    FileSystem* fileSystem = owner_->GetSubsystem<FileSystem>();

    // Filename may or may not be inside the resource system
    String fullName = binaryShaderName;
    if (!IsAbsolutePath(fullName))
    {
        // If not absolute, use the resource dir of the shader
        String shaderFileName = cache->GetResourceFileName(owner_->GetName());
        if (shaderFileName.Empty())
            return;
        fullName = shaderFileName.Substring(0, shaderFileName.Find(owner_->GetName())) + binaryShaderName;
    }
    String path = GetPath(fullName);
    if (!fileSystem->DirExists(path))
        fileSystem->CreateDir(path);

    SharedPtr<File> file(new File(owner_->GetContext(), fullName, FILE_WRITE));
    if (!file->IsOpen())
        return;

    file->WriteFileID("USHD");
    file->WriteShort((unsigned short)type_);
    file->WriteShort(3);

    file->WriteUInt(parameters_.Size());
    for (HashMap<StringHash, ShaderParameter>::ConstIterator i = parameters_.Begin(); i != parameters_.End(); ++i)
    {
        file->WriteString(i->second_.name_);
        file->WriteUByte((unsigned char)i->second_.register_);
        file->WriteUByte((unsigned char)i->second_.regCount_);
    }

    unsigned usedTextureUnits = 0;
    for (unsigned i = 0; i < MAX_TEXTURE_UNITS; ++i)
    {
        if (useTextureUnit_[i])
            ++usedTextureUnits;
    }
    file->WriteUInt(usedTextureUnits);
    for (unsigned i = 0; i < MAX_TEXTURE_UNITS; ++i)
    {
        if (useTextureUnit_[i])
        {
            file->WriteString(graphics_->GetTextureUnitName((TextureUnit)i));
            file->WriteUByte((unsigned char)i);
        }
    }

    unsigned dataSize = byteCode_.Size();
    file->WriteUInt(dataSize);
    if (dataSize)
        file->Write(&byteCode_[0], dataSize);
}
开发者ID:LumaDigital,项目名称:AtomicGameEngine,代码行数:56,代码来源:D3D9ShaderVariation.cpp

示例15: CreateDirs

bool FileUtils::CreateDirs(const String& folder)
{
    FileSystem* fileSystem = GetSubsystem<FileSystem>();

    Poco::File dirs(folder.CString());
    dirs.createDirectories();

    return fileSystem->DirExists(folder);

}
开发者ID:abandonrules,项目名称:AtomicGameEngine,代码行数:10,代码来源:FileUtils.cpp


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