depakeen
11-23-2011, 01:08 PM
Maybe this question has already been asked, but I didn't find it...
I'd like to get the default script path in a string. This is how I've done :
proc string JPL_Path ()
{
string $scriptPathArray [];
string $allPath = (getenv ("MAYA_SCRIPT_PATH"));
string $tokPath [];
string $path;
tokenize $allPath "\;" $tokPath;
string $buffer [];
tokenize $tokPath[1] "\/" $buffer; //index 0 is default project, 1 is scripts
for ($i = 0 ; $i < size ($buffer); $i++)
{
$scriptPathArray [$i] = $buffer [$i];
}
$path = stringArrayToString ($scriptPathArray, "\\\\");
return $path;
}
string $path = JPL_Path ();
It's a little bit long, I'm sure there is a much easier way to achieve the same thing.
By the way, I'm not sure that the order of MAYA_SCRIPT_PATH is always the same: if it's not, the index I chose may be wrong in some case...
Maybe I missed something easy and obvious, I look forward to your advice.
I'd like to get the default script path in a string. This is how I've done :
proc string JPL_Path ()
{
string $scriptPathArray [];
string $allPath = (getenv ("MAYA_SCRIPT_PATH"));
string $tokPath [];
string $path;
tokenize $allPath "\;" $tokPath;
string $buffer [];
tokenize $tokPath[1] "\/" $buffer; //index 0 is default project, 1 is scripts
for ($i = 0 ; $i < size ($buffer); $i++)
{
$scriptPathArray [$i] = $buffer [$i];
}
$path = stringArrayToString ($scriptPathArray, "\\\\");
return $path;
}
string $path = JPL_Path ();
It's a little bit long, I'm sure there is a much easier way to achieve the same thing.
By the way, I'm not sure that the order of MAYA_SCRIPT_PATH is always the same: if it's not, the index I chose may be wrong in some case...
Maybe I missed something easy and obvious, I look forward to your advice.
