// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // Creation Date: April 20, 1998 // // Description: // This script returns the parent of the current project directory // // Input Arguments: // None // // Return Value: // string - the parent of the current project dir // global proc string getParentDir( string $directory ) // // Description: // Get the parent directory of the given directory. // // Input Arguments: // $directory // // Return Value: // string - the parent // { string $result = $directory; int $i = size( $directory ) - 1; while ( $i >= 1 ) { string $char = substring( $directory, $i, $i ); if ( ( $char == "/" ) || ( $char == "\\" ) ) { if ( $i > 1 ) { $result = substring( $directory, 1, $i - 1 ); } else { $result = "/"; } break; } $i--; } return $result; } global proc string currentProjectParentDir() // // Description: // Global callback for getting the parent of the // current project's directory // // Return Value: // string - the parent of the current project dir // { string $projDir = `workspace -q -fn`; return getParentDir( $projDir ); }