Difference between revisions of "Path Aliases"

From The Foundry MODO SDK wiki
Jump to: navigation, search
m (Added an example for adding an Alias to the a config file and how to query it using python.)
m (Querying Path Aliases)
 
Line 17: Line 17:
  
 
== Querying Path Aliases ==
 
== Querying Path Aliases ==
 +
 
<tabber>
 
<tabber>
Python =
+
Python=
 
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
# python
+
# python
 
+
fileService = lx.service.File()
fileService = lx.service.File()
+
aliasPath = fileService.ToLocalAlias('pathAliasName:')
aliasPath = fileService.ToLocalAlias('pathAliasName:')
+
</syntaxhighlight>
 +
|-|
 +
LXMacro=
 +
<syntaxhighlight lang="python">
 +
#LXMacro#
 +
query platformservice alias ? "pathAliasName:"
 
</syntaxhighlight>
 
</syntaxhighlight>
 
</tabber>
 
</tabber>
 +
 
== More Information ==
 
== More Information ==
 
* [[PlatformService Reference]]
 
* [[PlatformService Reference]]
  
 
[[Category: Top level]]
 
[[Category: Top level]]

Latest revision as of 14:45, 5 April 2018

Path Aliases

modo supports arbitrary path aliases through the Path Alias preferences. These aliases provide OS-agnostic shortcuts to location in the file system. Each alias is in the form of alias: (note the colon symbol after the alias), and resolves to an absolute path. These are commonly used to provide custom mappings so that content can easily be shared between users. Path aliases are stored in configs.

Scripts and plug-ins can resolve path aliases into their absolute paths through the platformservice ScriptQuery interface.

Standard Paths

modo uses a number of standard paths for its configuration files, content, help and other resources. These are detailed in the Path Aliases: Standard Paths article.

Adding Aliases to a Config File

<atom type="PathAliases">
  <hash type="Alias" key="pathAliasName">
    <atom type="Path">C:\path\to\desired\folder</atom>
  </hash>
</atom>

Querying Path Aliases

<tabber>

Python=
 # python
 fileService = lx.service.File()
 aliasPath = fileService.ToLocalAlias('pathAliasName:')

|-|

LXMacro=
 #LXMacro#
 query platformservice alias ? "pathAliasName:"

</tabber>

More Information