Lasso Soft Inc. > Home

[ file->realpath ]

Method

The [file->realPath] method is a private method that returns the full path to a file. If it is called without a parameter, it returns the full path based on the path stored in the [file] object itself. If it is called with a parameter, it returns the full path to the path referenced by the parameter.

  • Syntax
define file->myMethod => {
    .realPath
}

define file->myMethod => {
    local(path) = ...
    .realPath(#path)
}
Examples
  • Beginner

Create a method to return the full path of a file

The code below creates member method [file->fileSystemPath] that returns the full path to a file. It then test the method by creating a [file] object with a web-root based path and calling the new method. The result assumes that your web-root is the standard Mac OS X path to the web-root (/Library/WebServer/Documents/).

Code

define file->fileSystemPath(path::string=.path) => {
    return .realPath(#path)
}
local(my_file)  = file('/rhino/test.txt')
#my_file->fileSystemPath

Result

//Library/WebServer/Documents//rhino/test.txt

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft