// =========================================================================== // 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 fromNativePath( string ) // // MEL Windows path file // // // Convert from '/' to '\' path formats on Windows, otherwise does nothing. // This proceedure can be used to try to unify path data to use the // forward slash character (a safer and more cross-platform way of // handling paths, since the forward slash is what Maya uses internally // to separate path names). // // // string $path // The path to be converted. // // // string $native = "c:\\examples\\scripts\\second\\city"; // // Note the double backslashes used in input - in MEL, backslash is // // a special escape character and for it to be understood as the // // backslash character, two backslashes must be used // string $path = fromNativePath( $native ); // // Result: c:/examples/scripts/second/city // On Windows // // // string: The converted path. // // global proc string fromNativePath ( string $strFile ) { if( `about -nt` ) { // this is only done when Python is available $strFile = python("(u\"" + encodeString($strFile) + "\").replace(\"\\\\\",\"/\");"); } return $strFile; }