PDA

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


ghostlake114
02-28-2008, 09:18 AM
Currently, the dirname command return to "/" path, for example

C:/data/model/testfile

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

so it will be

C:\data\model\testfile

greatPumpkin
02-28-2008, 10: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

Omita
02-28-2008, 09:56 PM
fromNativePath()

to go the otherway.

CGTalk Moderation
02-28-2008, 09: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.