// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // // // string toNativePath( string ) // // MEL Windows path file // // // Convert from '/' to '\\' path formats on Windows, otherwise does nothing. // Use this proceedure to convert pathnames retrieved from Maya to // more Windows-like backslash-separated pathnames (note that most Windows // system calls do handle forward slashes as path-delimiters). // // // string $path // The path to be converted. // // // // Find a file in a subdirectory of the current one // string $file = `workspace -q -fn`; // // Result: D:/Projects/projectOne/scene2 // On Windows // string $path = toNativePath( $file ); // // Result: D:\Projects\projectOne\scene2 // On Windows // // // string: The converted path. // // global proc string toNativePath ( string $strFile ) { if( `about -nt` ) { $strFile = python("(u\"" + encodeString($strFile) + "\").replace(\"/\",\"\\\\\");"); } return $strFile; }