XSIUtils.GetLocationType

導入

v5.0

詳細

指定されたファイル(完全パス)の場所が最もよくわかるsiInstallationPathから値を戻します。既存のファイルをパスで指定する必要はありません。

ユーザ設定のローカル位置にファイルが保存されているかどうか、またはファイルがワークグループのものであるかどうかを判断する場合に使用します。

スクリプト 構文

oReturn = XSIUtils.GetLocationType( path );

戻り値

siInstallationPath

パラメータ

パラメータ タイプ 詳細
path String ファイルまたはディレクトリへの完全パス。この場所がすでに存在している必要はありません。

JScript の例

/*
        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" ;        
        }
}

関連項目

XSIApplication.InstallationPath SIObject.Origin