GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members

ResourcesMergingHelper is used (mainly during export) to list resources and generate new filenames, to allow them to be all copied in a single directory (potentially changing the filename to avoid conflicts, but preserving extensions). More...

#include <ResourcesMergingHelper.h>

Inherits gd::ArbitraryResourceWorker.

Public Member Functions

 ResourcesMergingHelper (gd::ResourcesManager &resourcesManager, gd::AbstractFileSystem &fileSystem)
 
void SetBaseDirectory (const gd::String &baseDirectory)
 Set the directory used as base directory: All resources filename are relative to this directory. (usually, it is the project directory).
 
void PreserveDirectoriesStructure (bool preserveDirectoriesStructure_=true)
 Set if the directories structure, starting from the base directory, must be preserved. For compilation in GD C++ Platform, all resources must be in a single folder, so that the directories structure is not preserved.
 
void PreserveAbsoluteFilenames (bool preserveAbsoluteFilenames_=true)
 Set if the absolute filenames must be preserved.
 
std::map< gd::String, gd::String > & GetAllResourcesOldAndNewFilename ()
 Return a map containing the resources old absolute filename as key, and the resources new filenames as value. The new filenames are relative to the Base Directory.
 
void ExposeFile (gd::String &resource) override
 
- Public Member Functions inherited from gd::ArbitraryResourceWorker
 ArbitraryResourceWorker (gd::ResourcesManager &resourcesManager_)
 
void ExposeResources ()
 Expose a set of resources. More...
 
void ExposeResourceWithType (const gd::String &resourceType, gd::String &resourceName)
 Expose a resource from a given type.
 
virtual void ExposeImage (gd::String &imageName)
 Expose an image, which is always a reference to a "image" resource.
 
virtual void ExposeAudio (gd::String &audioName)
 Expose an audio, which is either a reference to an "audio" resource, or a filename if no resource with this name exists (for backward compatibility).
 
virtual void ExposeFont (gd::String &fontName)
 Expose a font, which is either a reference to a "font" resource, or a filename if no resource with this name exists (for backward compatibility).
 
virtual void ExposeJson (gd::String &jsonName)
 Expose a JSON, which is always a reference to a "json" resource.
 
virtual void ExposeTilemap (gd::String &tilemapName)
 Expose a Tilemap, which is always a reference to a "tilemap" resource.
 
virtual void ExposeTileset (gd::String &tilesetName)
 Expose a Tileset, which is always a reference to a "tileset" resource.
 
virtual void ExposeModel3D (gd::String &resourceName)
 Expose a 3D model, which is always a reference to a "model3D" resource.
 
virtual void ExposeAtlas (gd::String &resourceName)
 Expose an atlas, which is always a reference to a "atlas" resource.
 
virtual void ExposeSpine (gd::String &resourceName)
 Expose an spine, which is always a reference to a "spine" resource.
 
virtual void ExposeVideo (gd::String &videoName)
 Expose a video, which is always a reference to a "video" resource.
 
virtual void ExposeBitmapFont (gd::String &bitmapFontName)
 Expose a bitmap font, which is always a reference to a "bitmapFont" resource.
 
virtual void ExposeShader (gd::String &shaderName)
 Expose a shader. \warn Currently unsupported.
 
virtual void ExposeEmbeddeds (gd::String &resourceName)
 Expose the embedded resources of the specified resource.
 

Protected Member Functions

void SetNewFilename (gd::String oldFilename, gd::String newFilename)
 

Protected Attributes

std::map< gd::String, gd::StringoldFilenames
 
std::map< gd::String, gd::StringnewFilenames
 
gd::String baseDirectory
 
bool preserveDirectoriesStructure
 
bool preserveAbsoluteFilenames
 
gd::AbstractFileSystemfs
 The gd::AbstractFileSystem used to manipulate files.
 
- Protected Attributes inherited from gd::ArbitraryResourceWorker
gd::ResourcesManagerresourcesManager
 

Detailed Description

ResourcesMergingHelper is used (mainly during export) to list resources and generate new filenames, to allow them to be all copied in a single directory (potentially changing the filename to avoid conflicts, but preserving extensions).

See also
ArbitraryResourceWorker

Member Function Documentation

◆ ExposeFile()

void gd::ResourcesMergingHelper::ExposeFile ( gd::String resource)
overridevirtual

Resources merging helper collects all resources filenames and update these filenames.

Implements gd::ArbitraryResourceWorker.

Member Data Documentation

◆ newFilenames

std::map<gd::String, gd::String> gd::ResourcesMergingHelper::newFilenames
protected

New file names that can be accessed by their original name.

◆ oldFilenames

std::map<gd::String, gd::String> gd::ResourcesMergingHelper::oldFilenames
protected

Original file names that can be accessed by their new name.

◆ preserveAbsoluteFilenames

bool gd::ResourcesMergingHelper::preserveAbsoluteFilenames
protected

If set to true, the filenames which are absolute (C:\MyFile.png will not be transformed into a relative filename (MyFile.png).

◆ preserveDirectoriesStructure

bool gd::ResourcesMergingHelper::preserveDirectoriesStructure
protected

If set to true, the directory structure, starting from baseDirectory, will be preserved in filenames.


The documentation for this class was generated from the following files: