On Sat, Oct 29, 2016 at 8:39 AM Chad_Fox <chadlee...@gmail.com> wrote:

> Hi all,
>
> I'd like to confirm if the paths written in maya (on windows) has the
> correct character case. In otherwords I need to verify the path is good for
> use on Linux.
>
> I have the following solution, but glob is ... not very fast.
>
> Would like to know if anyone here has come accross an effective/fast
> solution for this problem.
>
> import glob
> import re
> import os
>
> def fix_path_case( path ):
>    case_on_disk_path = glob.glob( re.sub( r'([^:])(?=[/\\]|$)', r'[\1]' ,
> path ) )[0]
>    slash_fixed_path =  os.path.realpath(case_on_disk_path )
>    return slash_fixed_path
>
> # Real path on disk is      ''W:/Shows/Proj/Pub/TEX/Proj_skin_DIF.1001.TIF'
> bad_case_texture_path = 'W:/shOws/PRoj/PUB/tex/proj_skin_DIF.1001.tif'
> #path in maya
>
> fixed_path = fix_path_case( path = bad_case_texture_path )
>
>
>
> Thanks!
>
> Chad
>

Part of this problem, for me, would be something I would think to solve
through conventions at a facility. Are people actually using whatever
casing they feel like as opposed to what matches on disk? Is it really a
concern about the filename portion, or just a naming issue with the mount
points between Windows and Linux? And also, what is the logic of your regex
that you hope to express?

It would be difficult to know exactly what to transform the string into,
without also doing a glob of the filesytem. If people are allowed to use
any caseing they want, then you don't really have a choice but to stat the
directory and case-insensitive match the files with your string.

Justin


>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/11dfb149-d63d-4f1b-88d0-c02de401e86e%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/11dfb149-d63d-4f1b-88d0-c02de401e86e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3i07oDqNcTs8%3DUQ0FFHcBZbpRBe0sqSDtodNDpdzh_KQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to