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


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

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


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

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

示例2: RemoveLicense

void LicenseSystem::RemoveLicense()
{
    FileSystem* filesystem = GetSubsystem<FileSystem>();

    if (filesystem->FileExists(licenseFilePath_))
    {
        filesystem->Delete(licenseFilePath_);
    }

    if (filesystem->FileExists(licenseCachePath_))
    {
        filesystem->Delete(licenseCachePath_);
    }
}
开发者ID:EternalXY,项目名称:AtomicGameEngine,代码行数:14,代码来源:LicenseSystem.cpp

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

示例4: Import

bool TextureImporter::Import()
{
    AssetDatabase* db = GetSubsystem<AssetDatabase>();
    ResourceCache* cache = GetSubsystem<ResourceCache>();
    String cachePath = db->GetCachePath();

    FileSystem* fileSystem = GetSubsystem<FileSystem>();
    String compressedPath = cachePath + "DDS/" + asset_->GetRelativePath() + ".dds";
    if (fileSystem->FileExists(compressedPath))
        fileSystem->Delete(compressedPath);

    SharedPtr<Image> image = cache->GetTempResource<Image>(asset_->GetPath());

    if (image.Null())
        return false;

    if (compressTextures_ &&
        !image->IsCompressed())
    {
        fileSystem->CreateDirs(cachePath, "DDS/" + Atomic::GetPath(asset_->GetRelativePath()));

		float resizefactor;
		float width = image->GetWidth();
		float height = image->GetHeight();

		if (width > compressedSize_ || height > compressedSize_)
		{
			if (width >= height)
			{
				resizefactor = compressedSize_ / width;
			}
			else
			{
				resizefactor = compressedSize_ / height;
			}

			image->Resize(width*resizefactor, height*resizefactor);
		}

		if (image->SaveDDS(compressedPath))
		{			
			Renderer * renderer = GetSubsystem<Renderer>();
			renderer->ReloadTextures();
		}
    }

    // todo, proper proportions
    image->Resize(64, 64);

    // not sure entirely what we want to do here, though if the cache file doesn't exist
    // will reimport
    image->SavePNG(cachePath + asset_->GetGUID());

    // save thumbnail
    image->SavePNG(cachePath + asset_->GetGUID() + "_thumbnail.png");

    return true;
}
开发者ID:EternalXY,项目名称:AtomicGameEngine,代码行数:58,代码来源:TextureImporter.cpp

示例5: SaveConfiguration

/// Save account information to a file
void GameEconomicGameClient::SaveConfiguration(Configuration &configuration)
{
    /// Get Resource
    ResourceCache * cache = GetSubsystem<ResourceCache>();
    FileSystem * fileSystem = GetSubsystem<FileSystem>();

    String configFileName;

    /// Set directory and path for network file
    configFileName.Append(fileSystem->GetProgramDir().CString());
    configFileName.Append("");
    configFileName.Append("Configuration.xml");


    /// Check if the account file information exist
    if(fileSystem->FileExists(configFileName.CString()))
    {
        fileSystem->Delete(configFileName.CString());
    }

    cout << "It got here "<<endl;

    File saveFile(context_, configFileName.CString(), FILE_WRITE);

    XMLFile * preferencefileconfig  = new XMLFile(context_);

    XMLElement configElem = preferencefileconfig   -> CreateRoot("Configuration");
    XMLElement GameModeConfigurationElement = configElem.CreateChild("GameModeConfiguration");
    XMLElement VideoConfigurationElement= configElem.CreateChild("VideoConfiguration");

    /// Set true false
    if(configuration.GameModeForceTablet==true)
    {
        GameModeConfigurationElement.SetAttribute("GameModeForceTablet", "true");
    }
    else
    {
        GameModeConfigurationElement.SetAttribute("GameModeForceTablet", "false");
    }

    /// Convert video bloom to float
    String VideoBloomParamValue1String(configuration.VideoBloomParam1);
    String VideoBloomParamValue2String(configuration.VideoBloomParam2);

    /// Copy values testing
    VideoConfigurationElement.SetAttribute("BloomParam1",VideoBloomParamValue1String);
    VideoConfigurationElement.SetAttribute("BloomParam2",VideoBloomParamValue2String);

    preferencefileconfig->Save(saveFile);

    return;
}
开发者ID:vivienneanthony,项目名称:Urho3D-gameeconomic,代码行数:53,代码来源:GameEconomicGameClient.cpp

示例6: RemoveLicense

void LicenseSystem::RemoveLicense()
{
    FileSystem* filesystem = GetSubsystem<FileSystem>();

    String licenseFilePath = filesystem->GetAppPreferencesDir("AtomicEditor", "License");
    licenseFilePath = AddTrailingSlash(licenseFilePath);
    licenseFilePath += "AtomicLicense";

    if (filesystem->FileExists(licenseFilePath))
    {
        filesystem->Delete(licenseFilePath);
    }
}
开发者ID:ezhangle,项目名称:AtomicGameEngine,代码行数:13,代码来源:AELicenseSystem.cpp

示例7: HandleResourceDelete

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

    if (fs->DirExists(resourcePath))
    {
        fs->RemoveDir(resourcePath, true);

        GetSubsystem<MainFrame>()->GetProjectFrame()->Refresh();

        return;
    }
    else if (fs->FileExists(resourcePath))
    {
        if (!fs->Delete(resourcePath))
        {
            if (reportError)
            {
                String errorMsg;
                errorMsg.AppendWithFormat("Unable to delete:\n\n %s", resourcePath.CString());
                editor->PostModalError("Delete Resource Error", errorMsg);
            }

            return;
        }

        GetSubsystem<MainFrame>()->GetProjectFrame()->Refresh();

        return;
    }
    else
    {
        if (reportError)
        {
            String errorMsg;
            errorMsg.AppendWithFormat("Unable to find:\n\n %s", resourcePath.CString());
            editor->PostModalError("Delete Resource Error", errorMsg);
        }

        return;
    }

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


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