comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: relative path from one absolute path to another?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: relative path from one absolute path to another? [message #49741 is a reply to message #49643] Wed, 09 August 2006 12:17 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
JD Smith <jdsmith@as.arizona.edu> writes:
> On Wed, 09 Aug 2006 12:52:15 -0400, Craig Markwardt wrote:
>
>>
>> "born.in.sssr@gmail.com" <born.in.sssr@gmail.com> writes:
>>> Hi all,
>>> is there an easy way (without string scripting) to get the relative
>>> path from one absolute path to another (platform independent:
>>> unix+win)?
>>> In the kind of:
>>> rel_path = get_rel_path(from_path, to_path)
>>> Thanks, Maxim
>>
>> Sigh, a simple search on Google ("idl relative path") would have
>> picked up a routine I posted on my website two years ago, and saved
>> everybody a lot of work and trouble :-)
>
> One can't underestimate the trade-off of having to check someone else's
> code vs. writing it yourself for "small" problems like this. Does it
> work for Windows paths (with c:\foo or \\host\foo)?

Sure. Of course, if the drive letter is different, there is no
possible relative path.

Regarding links and FILE_SAME(), I didn't assume the directories
actually exist on disk. In my case, sometimes the relative path is
devised before the tree exists, so that assumption would have failed.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Interactive mode in IDL
Next Topic: Comparing Pixel Values in Images With IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 17:08:37 PDT 2025

Total time taken to generate the page: 1.28203 seconds