// =========================================================================== // 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: 2005 // // Description: // // global proc string getNameForCacheSubDir(int $unique, string $mainDir, string $subDirName) // // Return a name to use as the cache subdirectory name. // If $unique == true, then return a subdirectory whose // name does not overlap with an existing directory name. // If subDir != "" then use this instead of the scene name // for the subdirectory. // // { string $baseDirName = $mainDir; // If subDirName not provided, use scene name if possible // if( $subDirName == "" ) { string $sceneName = `file -shortName -q -sceneName`; if (size($sceneName) > 0) { string $buffer[]; tokenize($sceneName,".",$buffer); $subDirName = $buffer[0]; $baseDirName += $subDirName; } else { // the scene has no name, construct a suitable name // $subDirName = (uiRes("m_getNameForCacheSubDir.kUntitledScene")); $baseDirName += $subDirName; } } if ($unique) { int $counter = 0; $dir = $baseDirName; while (`file -q -exists $dir`) { $counter++; $dir = ($baseDirName + $subDirName + $counter); } return ($subDirName+$counter); } return $subDirName; }