in reply to Getting path info in a mixed UNIX / NT environment

Ok. To clarify a little...

The Environment vars will be set up correctly. And I forgot the "" around the path in the example... but that will be correct also. I looked at File::Path and it appears to be used for making and deleting directory trees. Not really what I'm looking for... I need a porting kind of solution for existing code.

There are 4 distinct drives(c:,j:,k:,l:) I have to access from the Win2000 systems. On unix they are simply paths. The unix systems are running in production as we speak.

My concern is that there are well over 50,000 lines of code now and I need a good and simple as possible solution to the drive mapping issue.

My idea is just that... an idea. I know there must be a better way because I'm relatively new to programming and how is it possibly for me to come up with the best idea as my first attempt?

So... looking back at my syntactically incorrect "idea"... can anyone tell me if the concept is correct or if there is a better way?

Prost,
Moe

  • Comment on Re: Getting path info in a mixed UNIX / NT environment

Replies are listed 'Best First'.
Re: Re: Getting path info in a mixed UNIX / NT environment
by myocom (Deacon) on Dec 08, 2000 at 04:43 UTC

    Your idea will probably work fine. Assuming that the environment variable 'SOME_DRIVE' contains something like 'J:', you might also consider something like this:

    $path = '/tmp/some/path'; $path = $ENV{SOME_DRIVE} . $path if $^O eq 'MSWin32'; # rest of code
      I thought of that also. Is that more stable? If so I will use it.

      Prost,
      Moe

        It's not really a case of stability--they're both equally "stable". I find the if $^O = 'MSWin32' bit somewhat easier to maintain, though. When you go back in 6 months to look at this code, you'll more easily be able to figure out why you're trying to modify $path.
Re: Re: Getting path info in a mixed UNIX / NT environment
by chipmunk (Parson) on Dec 08, 2000 at 04:31 UTC
    Doh, sorry. I meant File::Spec, not File::Path. File::Spec is good for handling paths in a platform independent manner.