Namespace: DuPath

DuPath

Paths related methods

Members

static,readonlyDuPath.SizeUnitstring

Units to use for sizes.
Properties:
Name Type Default Description
BIT string b
BYTE string B
KB string kB
MB string MB
GB string GB
TB string TB

Methods

staticDuPath.fixName(name, placeholder){string}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4936
Removes all forbidden characters from a string to be used as a filename
Name Type Default Description
name string The filename to fix
placeholder string '.' optional The string used to replace the forbidden characters
Returns:
Type Description
string The fixed filename

staticDuPath.getBasename(pathOrFile){String}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4842
Returns the basename of the given path or file
Name Type Description
pathOrFile String | File optional The file or the path
Returns:
Type Description
String The basename
Example
DuPath.getBasename(new File("D:/code/open/Duik/shape.test")) // "shape"
DuPath.getBasename("D:/code/open/Duik/shape.test") // "shape"

staticDuPath.getExtension(pathOrFile){String}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4863
Returns the extension of the given path or file
Name Type Description
pathOrFile String | File optional The file or the path
Returns:
Type Description
String The extension
Example
DuPath.getExtension(new File("D:/code/open/Duik/shape.other.test")) // "test"
DuPath.getExtension("D:/code/open/Duik/shape.test") // "test"

staticDuPath.getName(pathOrFile){String}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4822
Returns the name of the given path or file, as displayed by the filesystem
Name Type Description
pathOrFile String | File | Folder optional The file or the path
Returns:
Type Description
String The basename
Example
DuPath.getName(new File("D:\\code\\open\\Duik\\shape test.test")) // "shape test.test"
DuPath.getName("D:/code/open/Duik/other shape.test") // "other shape.test"

staticDuPath.incrementName(file){string}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4907
Increments the last number before the extension in a filename
Name Type Description
file File The file
Returns:
Type Description
string The incremented fileName

staticDuPath.join(parts, sep){String}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4772
Joins multiple paths togetther.
Name Type Default Description
parts Array.<string> optional The parts to join togehter
sep String "/" optional The separator to use. If not defined, will look for the first sep in the path.
Returns:
Type Description
String The final path

staticDuPath.newUniqueName(newName, folder, increment){string}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4893
Generates a new unique name for a file
Name Type Default Description
newName string The wanted new name
folder Folder The folder
increment boolean true optional true to automatically increment the new name if it already ends with a digit
Returns:
Type Description
string The unique name, with a new number at the end if needed.

staticDuPath.sizeFromBytes(size, to, decimals){float}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4794
Converts a number of Bytes to kB or MB or GB or TB For conversion to bits, a Byte is considered to be 8 bits.
Name Type Default Description
size int The size in Bytes to convert
to DuPath.SizeUnit DuPath.SizeUnit.MB optional The unit to convert to, one of: b, kB, MB, GB, TB
decimals int 2 optional The number of decimals to round the result
Returns:
Type Description
float The result of the conversion

staticDuPath.switchExtension(pathOrFile, newExtension){String}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4878
Switch the extension of the given path. Create a new path from a given path and a given extension.
Name Type Description
pathOrFile String | File optional The file or the path
newExtension String optional The new extension
Returns:
Type Description
String The new path