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

File path. More...

Inheritance diagram for Dragengine.File:

Public Member Functions

bool equals (Object object)
 Files are equal. More...
 
String getComponentAt (int index)
 Component at index. More...
 
int getComponentCount ()
 Count of components. More...
 
String getName ()
 Name of path which is the last path component or the prefix if empty. More...
 
String getPath ()
 String representation of path. More...
 
int hashCode ()
 Hash code of File. More...
 
bool isAbsolute ()
 Path is absolute. More...
 
bool isEmpty ()
 Path is empty. More...
 
bool isParentOf (File file)
 File is a direct or indirect parent of another file. More...
 
bool isParentOf (String path)
 File is a direct or indirect parent of another file. More...
 
bool isRelative ()
 Path is relative. More...
 
File new ()
 Create File with root path. More...
 
File new (File file)
 Create copy of file. More...
 
File new (File parent, File filename)
 Create File from filename appended to parent File. More...
 
File new (File parent, String filename)
 Create File from filename appended to parent File. More...
 
File new (String filename)
 Create File from filename. More...
 
File new (String parent, String filename)
 Create File from filename appended to parent File. More...
 
File operator+ (File file)
 Create File from filename appended to parent File. More...
 
File operator+ (String file)
 Create File from filename appended to parent File. More...
 
File operator- (File directory)
 Relative path or null. More...
 
File operator- (String directory)
 Relative path or null. More...
 
File relativePath (File file)
 Relative path or null. More...
 
File relativePath (String path)
 Relative path or null. More...
 
String toString ()
 String representation of this filename. More...
 

Static Public Member Functions

static File absolutePath (String path, String baseDirectory)
 Create absolute path of base directory and a potential relative path. More...
 
static bool isAbsolute (String path)
 Path is absolute. More...
 

Public Attributes

Array pComponents
 
String pPrefix
 

Detailed Description

File path.

This is not an open file but only an object for working with filenames. This object though can then be used with appropriate other objects to load files.

Member Function Documentation

◆ absolutePath()

static File Dragengine.File.absolutePath ( String  path,
String  baseDirectory 
)
static

Create absolute path of base directory and a potential relative path.

Used for loading files relative to a base path where the file path can be absolute or relative. If path is absolute a File instance of path is returned. If path is relative a File instance of baseDirectory with path appended is returned.

This method is safe to be used with path containing '..' at the beginning.

◆ equals()

bool Dragengine.File.equals ( Object  object)

Files are equal.

Parameters
objectObject to check.
Returns
True if both objects describe the same filename.

◆ getComponentAt()

String Dragengine.File.getComponentAt ( int  index)

Component at index.

◆ getComponentCount()

int Dragengine.File.getComponentCount ( )

Count of components.

◆ getName()

String Dragengine.File.getName ( )

Name of path which is the last path component or the prefix if empty.

◆ getPath()

String Dragengine.File.getPath ( )

String representation of path.

◆ hashCode()

int Dragengine.File.hashCode ( )

Hash code of File.

◆ isAbsolute() [1/2]

bool Dragengine.File.isAbsolute ( )

Path is absolute.

Path is absolute if prefix is '/'.

◆ isAbsolute() [2/2]

static bool Dragengine.File.isAbsolute ( String  path)
static

Path is absolute.

Returns
true if path begins with '/'.

◆ isEmpty()

bool Dragengine.File.isEmpty ( )

Path is empty.

◆ isParentOf() [1/2]

bool Dragengine.File.isParentOf ( File  file)

File is a direct or indirect parent of another file.

Typically used to check if a file is inside a directory.

◆ isParentOf() [2/2]

bool Dragengine.File.isParentOf ( String  path)

File is a direct or indirect parent of another file.

Version
1.20

Typically used to check if a file is inside a directory.

◆ isRelative()

bool Dragengine.File.isRelative ( )

Path is relative.

Path is relative if prefix is empty.

◆ new() [1/6]

File Dragengine.File.new ( )

Create File with root path.

◆ new() [2/6]

File Dragengine.File.new ( File  file)

Create copy of file.

◆ new() [3/6]

File Dragengine.File.new ( File  parent,
File  filename 
)

Create File from filename appended to parent File.

Parameters
parentPath to parse filename relative to.
filenameFilename to parse.
Exceptions
EInvalidParamfilename is absolute.

◆ new() [4/6]

File Dragengine.File.new ( File  parent,
String  filename 
)

Create File from filename appended to parent File.

Parameters
parentPath to parse filename relative to.
filenameFilename to parse.

◆ new() [5/6]

File Dragengine.File.new ( String  filename)

Create File from filename.

Parameters
filenameFilename to parse.

◆ new() [6/6]

File Dragengine.File.new ( String  parent,
String  filename 
)

Create File from filename appended to parent File.

Parameters
parentPath to parse filename relative to.
filenameFilename to parse.

◆ operator+() [1/2]

File Dragengine.File.operator+ ( File  file)

Create File from filename appended to parent File.

Parameters
parentPath to parse filename relative to.
filenameFilename to parse.

◆ operator+() [2/2]

File Dragengine.File.operator+ ( String  file)

Create File from filename appended to parent File.

Parameters
parentPath to parse filename relative to.
filenameFilename to parse.

◆ operator-() [1/2]

File Dragengine.File.operator- ( File  directory)

Relative path or null.

Version
1.20

If file.isParentOf(this) is true returns relative path to file.

◆ operator-() [2/2]

File Dragengine.File.operator- ( String  directory)

Relative path or null.

Version
1.20

If file.isParentOf(this) is true returns relative path to file.

◆ relativePath() [1/2]

File Dragengine.File.relativePath ( File  file)

Relative path or null.

Version
1.20

If isParentOf(file) is true returns relative path to this path.

◆ relativePath() [2/2]

File Dragengine.File.relativePath ( String  path)

Relative path or null.

Version
1.20

If isParentOf(file) is true returns relative path to this path.

◆ toString()

String Dragengine.File.toString ( )

String representation of this filename.

Same as getPath().

Member Data Documentation

◆ pComponents

Array Dragengine.File.pComponents

◆ pPrefix

String Dragengine.File.pPrefix

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