lucee.Componentcommandbox.system.util.FileSystem
Copyright Since 2014 CommandBox by Ortus Solutions, Corp www.coldbox.org | www.ortussolutions.com I contain helpful methods for dealing with file and directory paths
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
any
|
configService
|
true
|
false
|
|
any
|
coreClassLoader
|
true
|
false
|
|
any
|
logger
|
true
|
false
|
|
any
|
os
The os.
|
true
|
false
|
|
any
|
shell
|
true
|
false
|
|
any
|
tempDir
|
true
|
false
|
Constructor Summary | |
---|---|
init()
|
Method Summary | |
---|---|
any
|
_classLoad([string path])
|
array
|
browserList()
|
string
|
calculateCanonicalPath(string path)
I wrote my own version of this because the getCanonicalPath() runs isDirectory() and exists(). |
any
|
classLoad([any paths])
|
any
|
createMapping([any mappingName], [any mappingPath])
|
any
|
extractTarGz(string sourceFile, string targetFolder)
Extract a tar. |
string
|
getConfigService()
|
any
|
getCoreClassLoader([string path])
|
any
|
getDefaultNativeShell()
|
any
|
getJREExecutable([any javaHome])
Get the JRE Executable from the File System. |
any
|
getJavaFile(any file)
Get a native java. |
string
|
getLogger()
|
any
|
getNativeShell()
|
string
|
getOs()
|
string
|
getShell()
|
string
|
getTempDir()
|
boolean
|
isDriveRoot(string path)
Tells you if a path is the drive root. |
boolean
|
isLinux()
|
boolean
|
isMac()
|
boolean
|
isWindows()
|
string
|
locateDriveMapping(string driveLetter)
Accepts a Windows drive letter and returns a CF Mapping. |
string
|
locateUNCMapping(string UNCShare)
Accepts a Windows UNC network share and returns a CF Mapping. |
string
|
locateUnixDriveMapping(string rootFolder)
Accepts a Unix root folder and returns a CF Mapping. |
any
|
lockingFileRead(string path)
|
any
|
lockingFileWrite(string path, string contents)
|
string
|
makePathRelative(string absolutePath)
Accepts an absolute path and returns a relative path. |
any
|
normalizeSlashes([string path])
|
boolean
|
openBrowser(any URI, [any browser=''])
Operating system browser opener. |
boolean
|
openNatively(any file)
Operating system open files or directories natively. |
any
|
resolvePath(string path, [any basePath='[runtime expression]'], [boolean forceDirectory='false'])
This resolves an absolute or relative path using the rules of the operating system and CLI. |
any
|
setConfigService(any configService)
|
any
|
setCoreClassLoader(any coreClassLoader)
|
any
|
setLogger(any logger)
|
any
|
setOs(any os)
|
any
|
setShell(any shell)
|
any
|
setTempDir(any tempDir)
|
Methods inherited from class lucee.Component |
---|
None |
Constructor Detail |
---|
Property Detail |
---|
access
- publicrequired
- falsereturntype
- anyinject
- configServiceserializable
- trueaccess
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- logbox:logger:{this}serializable
- trueThe os
access
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- shellserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- tempDir@constantsserializable
- trueMethod Detail |
---|
path
I wrote my own version of this because the getCanonicalPath() runs isDirectory() and exists() checks inside of it which SLOW DOWN when ran tens of thousands of times at once! This function differs from getCanonicalPath() in that it won't append a trailing slash if the path points to an actual folder.
path
- The path to Canonicalizepaths
mappingName
mappingPath
Extract a tar.gz file into a folder
sourceFile
targetFolder
path
Get the JRE Executable from the File System
javaHome
Get a native java.io.File object
file
Tells you if a path is the drive root
path
- The path to look atAccepts a Windows drive letter and returns a CF Mapping Creates the mapping if it doesn't exist
driveLetter
Accepts a Windows UNC network share and returns a CF Mapping Creates the mapping if it doesn't exist
UNCShare
Accepts a Unix root folder and returns a CF Mapping Creates the mapping if it doesn't exist
rootFolder
path
path
contents
Accepts an absolute path and returns a relative path Does NOT apply any canonicalization
absolutePath
path
Operating system browser opener
URI
- the URI to openbrowser
- the browser to useOperating system open files or directories natively
file
- the file/directory to openThis resolves an absolute or relative path using the rules of the operating system and CLI. It doesn't follow CF mappings and will also always return a trailing slash if pointing to an existing directory. Resolve the incoming path from the file system
path
- The directory to resolvebasePath
- An expanded base path to resolve the path against. Defaults to CWD.forceDirectory
- is for optimization. If you know the path is a directory for sure, pass true and we'll skip the directoryExists() check for performanceconfigService
coreClassLoader
logger
os
shell
tempDir