GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Public Member Functions | Static Public Member Functions | List of all members

An interface to manipulate files in a platform agnostic way. This allow exporters to work on files without knowing what is actually being used to manipulate files (Node.js, browser shims, etc...) More...

#include <AbstractFileSystem.h>

Public Member Functions

virtual void MkDir (const gd::String &path)=0
 Create the specified directory. More...
 
virtual bool DirExists (const gd::String &path)=0
 Return true if the specified directory exists.
 
virtual bool FileExists (const gd::String &path)=0
 Return true if the specified file exists.
 
virtual bool ClearDir (const gd::String &directory)=0
 Clear the directory given as parameter, removing all the files.
 
virtual gd::String GetTempDir ()=0
 Get a directory suitable for temporary files.
 
virtual gd::String FileNameFrom (const gd::String &file)=0
 Extract the name of the file (with its extension) from a path.
 
virtual gd::String DirNameFrom (const gd::String &file)=0
 Extract the path without the filename.
 
virtual bool MakeAbsolute (gd::String &filename, const gd::String &baseDirectory)=0
 Change the filename so that it is absolute, using the base directory passed as parameter. More...
 
virtual bool IsAbsolute (const gd::String &filename)=0
 Return true if the filename is absolute.
 
virtual bool MakeRelative (gd::String &filename, const gd::String &baseDirectory)=0
 Change the filename so that it is relative to the base directory passed as parameter. More...
 
virtual bool CopyFile (const gd::String &file, const gd::String &destination)=0
 Copy a file. More...
 
virtual bool WriteToFile (const gd::String &file, const gd::String &content)=0
 Write the content of a string to a file. More...
 
virtual gd::String ReadFile (const gd::String &file)=0
 Read the content of a file. More...
 
virtual std::vector< gd::StringReadDir (const gd::String &path, const gd::String &extension="")=0
 Return a vector containing the files in the specified path. More...
 

Static Public Member Functions

static gd::String NormalizeSeparator (gd::String filename)
 Make sure that only slash are used as a path separator: all backslashs are converted to forward slashs. More...
 

Detailed Description

An interface to manipulate files in a platform agnostic way. This allow exporters to work on files without knowing what is actually being used to manipulate files (Node.js, browser shims, etc...)

Member Function Documentation

virtual bool gd::AbstractFileSystem::CopyFile ( const gd::String file,
const gd::String destination 
)
pure virtual

Copy a file.

Returns
true if the operation succeeded.
virtual bool gd::AbstractFileSystem::MakeAbsolute ( gd::String filename,
const gd::String baseDirectory 
)
pure virtual

Change the filename so that it is absolute, using the base directory passed as parameter.

Returns
true if the operation succeeded.
virtual bool gd::AbstractFileSystem::MakeRelative ( gd::String filename,
const gd::String baseDirectory 
)
pure virtual

Change the filename so that it is relative to the base directory passed as parameter.

Returns
true if the operation succeeded.
virtual void gd::AbstractFileSystem::MkDir ( const gd::String path)
pure virtual

Create the specified directory.

Parameters
pathThe directory to create.
gd::String gd::AbstractFileSystem::NormalizeSeparator ( gd::String  filename)
static

Make sure that only slash are used as a path separator: all backslashs are converted to forward slashs.

Use this method when you get a filename from a file dialog for example: it ensures that filenames will be usable from Windows to Linux (as long as the filename is not an absolute path).

Parameters
filenameThe filename to normalize
Returns
The normalized filename.
virtual std::vector<gd::String> gd::AbstractFileSystem::ReadDir ( const gd::String path,
const gd::String extension = "" 
)
pure virtual

Return a vector containing the files in the specified path.

Parameters
pathThe path to read
extensionIf specified, only file finishing with this extension will be returned
Returns
A vector with all the matched files
virtual gd::String gd::AbstractFileSystem::ReadFile ( const gd::String file)
pure virtual

Read the content of a file.

Returns
The content of the file.
virtual bool gd::AbstractFileSystem::WriteToFile ( const gd::String file,
const gd::String content 
)
pure virtual

Write the content of a string to a file.

Returns
true if the operation succeeded.

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