View Full Version : File path change to "\" instead of "/"

02 February 2008, 10:18 AM
Currently, the dirname command return to "/" path, for example


I write down this into a text file, so how to replace all "/" in this text file into "\"

so it will be


02 February 2008, 11:09 AM
You can use toNativePath :(this code is cut and pasted from the maya docs)

// Find a file in a subdirectory of the current one

string $file = `workspace -q -fn`;

// Result: D:/Projects/projectOne/scene2 // On Windows

// Result: /usr/guest/maya/projects/projectOne/scene2 // On IRIX

string $path = toNativePath( $file );

// Result: D:\Projects\projectOne\scene2 // On Windows

// Result: /usr/guest/maya/projects/projectOne/scene2 // On IRIX

02 February 2008, 10:56 PM

to go the otherway.

CGTalk Moderation
02 February 2008, 10:56 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.