FilePath

public final CLASS
 

Class Description

A utlity class for manipulating file paths.

 

Listing

 

Methods

dirname(filepath:String):String
static
Returns all components of the given filepath except the last one.
basename(filepath:String, extension:String=null):String
static
Returns the last component of the given filepath.
extname(filepath:String):String
static
Returns any characters after the last period (.) in the given filepath.
isDir(path:String):Boolean
static
Tests that path exists and is a directory on the filesystem.
isFile(path:String):Boolean
static
Tests that path exists and is a file on the filesystem.
join(...components:Vector.<Object>):String
static
Combines the given components into a path delimited by the system folder delimiter.
 

Details

 

Methods

 

dirname()
static

public static function dirname(filepath:String):String

Returns all components of the given filepath except the last one.

The returned string does not contain a trailing delimiter.

filepath:StringPath to a file for which the containing directory is desired
returns
String

Path up to but not including the file or a trailing delimiter

 

basename()
static

public static function basename(filepath:String, extension:String=null):String

Returns the last component of the given filepath.

If extension is given and found at the end of filepath, it is removed. If extension is .*, any extension will be removed.

filepath:StringPath to a file for which the filename is desired
extension:String=null
optional
 File suffix to remove. Either as a wildcard (.*), or as a literal string not including . (e.g. png or txt)
returns
String

Filename from the given path, optionally with extension removed

 

extname()
static

public static function extname(filepath:String):String

Returns any characters after the last period (.) in the given filepath.

If no period exists in the filename, the empty string is returned. If a period is the last character in the filename, the empty string is returned.

filepath:StringPath to a file for which the file extension is desired
returns
String

File extension from the given path, or empty string

 

isDir()
static

public static function isDir(path:String):Boolean

Tests that path exists and is a directory on the filesystem.

path:StringPath to test as a directory
returns
Boolean

true when path is a directory

 

isFile()
static

public static function isFile(path:String):Boolean

Tests that path exists and is a file on the filesystem.

path:StringPath to test as a file
returns
Boolean

true when path is a file, and not a directory

 

join()
static

public static function join(...components:Vector.<Object>):String

Combines the given components into a path delimited by the system folder delimiter.

Components can be any mix of single string values, single objects that provide a toString() method, or Vectors of strings or objects:

  • FilePath.join('a', 'b', 'c', 'file.ext')
  • FilePath.join('a', ['b', 'c'], 'file.ext')
  • FilePath.join('a', b, c, 'file.ext') // where b,c .toString() are valid
  • FilePath.join('a', [b, c], 'file.ext') // ^^

The returned string does not contain a trailing delimiter.

With the exception of a leading delimiter on the first component, all leading and trailing delimiters will be stripped from individual components.

Delimiters existing within a component are left alone.

...components:Vector.<Object>
optional
 Any mix of single string values, single objects that provide a toString() method, or Vectors of strings or objects
returns
String

Single string of components joined by the system folder delimiter, but without a trailing delimiter

 

 

 

 

 

 

 

 

 

 

lsdoc 2018 pixeldroid
https://github.com/pixeldroid/lsdoc
programming pages theme v0.5.10 (https://github.com/pixeldroid/programming-pages)