path_convert "/from/path" "/to/path"
Note: backslashes are escape characters inside the quotes
(to allow for escaping double quotes, e.g. \").
This means to specify a backslash, you have to specify two.
So to specify \\ourserver\foo you'd need to actually specify
"\\\\ourserver\\foo" in the path_convert command.
For instance, let's say we have a farm of linux and windows.
We want pathnames on linux to be "/ourserver/jobs", and on on
Windows we want that same path to be "//ourserver/jobs". So then
we'd add the following settings (shown in red)
to the rush/etc/path_convert file:
rush/etc/path_convert
|
# Example rush/etc/path_convert file.
# For documentation on this file's format, see:
# http://seriss.com/rush.103.00/rush-files.html#path_convert
# [..snip..]
#### ADD YOUR PATHCONVERT FILE COMMANDS BELOW THIS LINE ###
os=linux path_convert "//ourserver/jobs" "/ourserver/jobs"
os=windows path_convert "/ourserver/jobs" "//ourserver/jobs"
|
|
You would the use
'rush -push path_convert +any' to
push that change to the network. Both the Perl and Python 103.xx
submit scripts automatically run paths through the path conversions
in this file.
You can test how paths are converted with the 'rush -pathconvert /some/path' command,
or use that command in scripts to convert paths.
For example, using the above example, the 'rush -pathconvert'
command will give these results on a Windows machine:
C:\> rush -pathconvert /ourserver/jobs/scenes/foo.ma
//ourserver/jobs/scenes/foo.ma
C:\> rush -pathconvert //ourserver/jobs/scenes/foo.ma
//ourserver/jobs/scenes/foo.ma
..and these results on a Linux machine:
fred@linux-r021 $ rush -pathconvert /ourserver/jobs/scenes/foo.ma
/ourserver/jobs/scenes/foo.ma
fred@linux-r021 $ rush -pathconvert //ourserver/jobs/scenes/foo.ma
/ourserver/jobs/scenes/foo.ma
Let's also say that on Macs we want a pathname like /Volumes/jobs to be converted to
"//ourserver/jobs", then we would also add this line (shown in red)
to the path_convert file:
rush/etc/path_convert
|
# Example rush/etc/path_convert file.
# For documentation on this file's format, see:
# http://seriss.com/rush.103.00/rush-files.html#path_convert
# [..snip..]
#### ADD YOUR PATHCONVERT FILE COMMANDS BELOW THIS LINE ###
os=linux path_convert "//ourserver/jobs" "/ourserver/jobs"
os=windows path_convert "/ourserver/jobs" "//ourserver/jobs"
os=all path_convert "/Volumes/jobs" "//ourserver/jobs"
|
|
Scripting
Scripts can use 'rush -pathconvert' to normalize pathnames.
For instance, in perl:
Perl example using 'rush -pathconvert'
|
#!/usr/bin/perl
my $infile = "/ourserver/jobs/scenes/foo.ma";
print "BEFORE: '$infile'\n";
$infile = `rush -pathconvert $infile`; chomp($infile); # convert the pathname
print " AFTER: '$infile'\n";
|
With the above example path_convert file, on Windows, the above would print:
BEFORE: '/ourserver/jobs/scenes/foo.ma'
AFTER: '//ourserver/jobs/scenes/foo.ma'
A python equivalent of the above would be:
Python example using 'rush -pathconvert'
|
#!/usr/bin/env python
import os,sys
infile = "/ourserver/jobs/scenes/foo.ma"
print("BEFORE: '%s'" % infile)
infile = os.popen("rush -pathconvert " + infile).read().rstrip('\r\n') # convert the pathname
print(" AFTER: '%s'" % infile)
|
This should give the same results as the perl script.
And finally, an example in a csh script:
Csh example using 'rush -pathconvert'
|
#!/bin/csh -f
set infile = /ourserver/jobs/scenes/foo.ma
echo "BEFORE: '$infile'"
set infile = `rush -pathconvert $infile` # convert the pathname
echo " AFTER: '$infile'"
|
This should give the same results as the perl and python scripts.
|