v5.0
Returns the value from the siInstallationPath enum that best
describes where the specified file (complete path) is located. It
is not necessary for the path to point to an existing file.
A possible use of this method is to determine if a file is stored
locally in the user's settings, or comes from a workgroup
location.
oReturn = XSIUtils.GetLocationType( path ); |
Parameter | Type | Description |
---|---|---|
path | String | Complete path to a file or directory. The location does not need to exist. |
/* This example demonstrates how to use the GetLocationType to see find out whether the file originated in the project path. */ var userpath = Application.InstallationPath( siUserPath ) ; userpath = ConvertInstallationPathToString( XSIUtils.GetLocationType(userpath) ); Application.LogMessage( userpath ) ; // Any file, directory below the user path (even if it doesn't exist yet) will // be identified as being part of the user path userpath += "/Application/Plugins/foo.vbs" ; // Adjust slashes in case we are running on Windows userpath = XSIUtils.ResolvePath( userpath ) ; userpath = ConvertInstallationPathToString( XSIUtils.GetLocationType(userpath) ); Application.LogMessage( userpath ) ; // Demonstrate how you could easily test if a scene file is part of the // current project var projpath = Application.InstallationPath( siProjectPath ) ; projpath += "/Scenes/somescene.scn" ; projpath = XSIUtils.ResolvePath( projpath ) ; if ( XSIUtils.GetLocationType(projpath) == siProjectPath ) { Application.LogMessage( "This scene is part of the current project" ) ; } // Expected results: //INFO : siUserPath //INFO : siProjectPath //INFO : This scene is part of the current project // Convenience function function ConvertInstallationPathToString( in_location ) { switch ( in_location ) { case siProjectPath : return "siProjectPath" ; case siUserPath : return "siUserPath" ; case siWorkgroupPath : return "siWorkgroupPath" ; case siFactoryPath : return "siFactoryPath" ; case siAddonPath : return "siAddonPath" ; case siUserAddonPath : return "siUserAddonPath" ; case siWorkgroupAddonPath : return "siWorkgroupAddonPath" ; case siCustomPath : return "siCustomPath" ; default : return "siUnknownPath" ; } } |