Modules/FileSystem/translator/relPath: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ This function transform a path that is passed to it into a path that is relative to the translators current directory. The path must be accessible from the translator. The path can either be absolute or relative. ==Syntax== <syntaxhighlight lang="lua"> string translator:relPath ( string path ) </syntaxhighlight> ==Arguments== *'''path:''' the path that should be transformed into a relative path; can be nil if the current directory should be returned ==Return...") |
No edit summary |
||
Line 1: | Line 1: | ||
<pageclass class="#3c82c8" subcaption="Translator function"></pageclass> | |||
__NOTOC__ | __NOTOC__ | ||
This function transform a path that is passed to it into a path that is relative to the translators current directory. The path must be accessible from the translator. The path can either be absolute or relative. | This function transform a path that is passed to it into a path that is relative to the translators current directory. The path must be accessible from the translator. The path can either be absolute or relative. |
Latest revision as of 03:28, 23 January 2022
This function transform a path that is passed to it into a path that is relative to the translators current directory. The path must be accessible from the translator. The path can either be absolute or relative.
Syntax
string translator:relPath ( string path )
Arguments
- path: the path that should be transformed into a relative path; can be nil if the current directory should be returned
Returns
This function returns the relative version of the path that is passed to it, false if the specified path is not accessible by the translator.
Example
Click to collapse [-]
ClientThis snippet converts the path relative from one translator to a relative path from another translator.
local function getPathTranslatorRelative( srcTranslator, dstTranslator, srcPath ) -- Get the absolute path from the srcTranslator perspective. local absPath = srcTranslator:absPath( srcPath ); -- Return the relative path from the dstTranslator. Will return false if conversion cannot happen. return dstTranslator:relPath( absPath ); end