# change based on OS
import platform
# creates user system variables
varRoot_Win = nuke.getInput('Windows File Root', 'E:/')
varRoot_Lin = nuke.getInput('Linux File Root', '/media/Waterfall/')
# make sure that the file paths end in a backslash (/)
if varRoot_Win[ len(varRoot_Win) - 1 ] != '/':
varRoot_Win += '/'
if varRoot_Lin[ len(varRoot_Lin) - 1 ] != '/':
varRoot_Lin += '/'
# create a list of all of only the Read nodes in the Nuke script
a = nuke.allNodes('Read')
if (platform.system() == 'Windows') or (platform.system() == 'Microsoft'):
print 'OS = Windows'
else:
print 'OS = Linux'
i = 0
for n in a:
# set the working node from the list of nodes based on it's name
b = nuke.toNode(a[i].name())
# get the file path for the current node
c = b['file'].getValue()
# query the OS and change the file path appropiately
if (platform.system() == 'Windows') or (platform.system() == 'Microsoft'):
d = c.replace(varRoot_Lin, varRoot_Win)
else:
d = c.replace(varRoot_Win, varRoot_Lin)
# replace the file path with the new file path
b['file'].setValue(d)
i += 1