You are here: User Guide > Nuke > Configuring Nuke > Handling File Paths Cross Platform

Handling File Paths Cross Platform

If your facility uses Nuke on several operating systems, you may want to configure Nuke to replace the beginnings of file paths so that scripts created on one platform also work on another.

For example, to ensure file paths created on Windows also work on Linux and vice versa, you can do the following:

1.   Create a file called init.py in your plug-in path directory if one doesn’t already exist.

For more information on plug-in path directories, see Loading Gizmos, NDK Plug-ins, and Python and TCL Scripts.

2.   Open the init.py file in a text editor and add an entry in the following format:

import platform

 

def filenameFix(filename):

if platform.system() in ("Windows", "Microsoft"):

return filename.replace( "/SharedDisk/", "p:\\" )

else:

return filename.replace( "p:\\", "/SharedDisk/" )

return filename

This way, the Windows file paths (beginning with p:\ in the above example) are replaced with the Linux file paths (beginning with /SharedDisk/) under the hood whenever a Nuke script is used on Linux. Otherwise, the Windows file paths are used.

Note that the file paths displayed in the graphical user interface (GUI) do not change. If you are using p:\ in a node control, this is still displayed as p:\. However, on Linux, Nuke interprets p:\ as /SharedDisk/.