Drag[en]gine Script Module DragonScript  1.23
Dragengine.FileSystem Class Reference

File system. More...

Inheritance diagram for Dragengine.FileSystem:

Static Public Member Functions

Management
static byte getSeparator ()
 Filepath separator character for this operating system. More...
 
static byte getPathSeparator ()
 Path list separator character for this operating system. More...
 
static String getCurrentPrefix ()
 Current path prefix for this operating system. More...
 
static String getGamePath ()
 Path string set by the game. More...
 
Virtual file system access
static bool existsFile (String path)
 File exist. More...
 
static bool canReadFile (String path)
 File can be read. More...
 
static bool canWriteFile (String path)
 File can be written. More...
 
static bool canDeleteFile (String path)
 File can be deleted. More...
 
static void deleteFile (String path)
 Delete file. More...
 
static FileType getTypeOfFile (String path)
 Type of file. More...
 
static void searchFiles (String directory, bool recursive, Block ablock)
 Search for files. More...
 
static bool pathMatchesPattern (String string, String pattern)
 Path matches a file pattern. More...
 
static void browseOverlay (String path)
 Browse overlay path. More...
 
static void browseCapture (String path)
 Browse capture path. More...
 
static void browseConfig (String path)
 Browse config path. More...
 
static Array getFileExtensions (ResourceLoaderType type)
 Get file extension list for resource type for use in file browsing. More...
 
static void openUrl (String url)
 Open URL using user defined application. More...
 

Detailed Description

File system.

This is a native class. This is a pure static class. The class can not be instantiated

Member Function Documentation

◆ browseCapture()

static void Dragengine.FileSystem.browseCapture ( String  path)
static

Browse capture path.

Version
1.7

Open operating system native file browser showing the content of path inside the currently running game capture directory. If the directory not exist it is created.

If path is an absolute path it has to start with "/capture" directory. If path is relative it is considered relative to "/capture" directory.

Calling this function switches the focus to another application.

◆ browseConfig()

static void Dragengine.FileSystem.browseConfig ( String  path)
static

Browse config path.

Version
1.7

Open operating system native file browser showing the content of path inside the currently running game config directory. If the directory not exist it is created.

If path is an absolute path it has to start with "/config" directory. If path is relative it is considered relative to "/config" directory.

Calling this function switches the focus to another application.

◆ browseOverlay()

static void Dragengine.FileSystem.browseOverlay ( String  path)
static

Browse overlay path.

Version
1.7

Open operating system native file browser showing the content of path inside the currently running game overlay directory. If the directory not exist it is created.

Calling this function switches the focus to another application.

◆ canDeleteFile()

static bool Dragengine.FileSystem.canDeleteFile ( String  path)
static

File can be deleted.

◆ canReadFile()

static bool Dragengine.FileSystem.canReadFile ( String  path)
static

File can be read.

◆ canWriteFile()

static bool Dragengine.FileSystem.canWriteFile ( String  path)
static

File can be written.

◆ deleteFile()

static void Dragengine.FileSystem.deleteFile ( String  path)
static

Delete file.

◆ existsFile()

static bool Dragengine.FileSystem.existsFile ( String  path)
static

File exist.

If the filename is relative it is checked against the game path.

◆ getCurrentPrefix()

static String Dragengine.FileSystem.getCurrentPrefix ( )
static

Current path prefix for this operating system.

◆ getFileExtensions()

static Array Dragengine.FileSystem.getFileExtensions ( ResourceLoaderType  type)
static

Get file extension list for resource type for use in file browsing.

Version
1.7

Returns an Array of FileExtension objects. For each running engine module of the respective type one FileExtension object is created. The FileExtension object contains the display name, an Array of file patterns in the form ".xyz" and a default extension in the form ".xyz".

◆ getGamePath()

static String Dragengine.FileSystem.getGamePath ( )
static

Path string set by the game.

◆ getPathSeparator()

static byte Dragengine.FileSystem.getPathSeparator ( )
static

Path list separator character for this operating system.

◆ getSeparator()

static byte Dragengine.FileSystem.getSeparator ( )
static

Filepath separator character for this operating system.

◆ getTypeOfFile()

static FileType Dragengine.FileSystem.getTypeOfFile ( String  path)
static

Type of file.

◆ openUrl()

static void Dragengine.FileSystem.openUrl ( String  url)
static

Open URL using user defined application.

Version
1.9

Calling this function switches the focus to another application.

◆ pathMatchesPattern()

static bool Dragengine.FileSystem.pathMatchesPattern ( String  string,
String  pattern 
)
static

Path matches a file pattern.

◆ searchFiles()

static void Dragengine.FileSystem.searchFiles ( String  directory,
bool  recursive,
Block  ablock 
)
static

Search for files.

Each file entry is visited using the provided block. The block receives as arguments the file name (String) and file type (FileType). The block has to return boolean indicating if the search has to continue(true) or stop(false).

Example code:

FileSystem.searchFiles("/content/models", true, block String path, FileType type
...
return true // continue(true) or stop(false)
end)

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