Lasso Soft Inc. > Home

[ file_forceRoot ]


This method handles adjusting file paths to provide transparent access to web-root based files. It is called by the [file] and [dir] types when opening their sources.

When running the Lasso Server and using Lasso to respond to web requests, absolute file paths are taken to be specified from the web-root unless prefixed with '//' in Mac OS X and Linux or by drive letter and two slash in Windows like 'C://'.  This method translates the absolute paths to a fully qualified path for Lasso.

For example, if your web-root is located at '/Library/WebServer/Documents/' and you specify a file path of '/home/dashboard/stats.txt' when creating a file object, then the [file] creator method uses this method to find the full path of the file you are referencing ('/Library/WebServer/Documents/home/dashboard/stats.txt') so that it can interact with the file.

This method comes in two flavors: one with no parameters and one that takes one parameter. Calling [file_forceRoot] with no parameters returns the path to prepend to an absolute path. The one parameter it can take is a file path as a string. When called in this manner, [file_forceRoot] determines if the path is a relative path and just returns it, or if it is an absolute path and returns the path with the web-root path prepended to it.

It is important to note that when this method is called when running Lasso code from the command line and not through Lasso Server, it will always return an empty string since there is no web-root for absolute paths to be based on.

  • Syntax


No examples found

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 2014 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft