Jump to content
Sign in to follow this  
koffeeman

relative filespec vs absolute filespec

Recommended Posts

koffeeman

i think i want to do something and was wondering if anyone has done it before (haven't been able to find it if it has) or if you think i'm nuts for wanting it.

i'm not sure how well i can explain it, but i'll try.

i am writing the front end to an application that generates a LOT of web pages (nothing complex in them, but there are a lot of pages and links from one leg to another leg very often)

currently i have a button (in the front end app written in autoit) that brings up a tree diagram of the directory tree structure and lets you select the html file you want to link to. it returns the full filespec as in: "c:\web\aaa\bbb\ccc\index.html"

what i would like to do is select the target html file the same way (using a treeview type box) - but instead of having the string returned as "c:\web\aaa\bbb\ccc\index.html" - i would like the string returned to be relative to where it is at and return a string more like "..\..\ddd\index.html" (which would be "c:\web\aaa\ddd\index.html")

another example:

you are generating "c:\uuu\vvv\www\xxx\yyy\zzz\index.html" and you want to add a link to "c:\uuu\vvv\www\xxx\aaa\index.html".

you can say "<a href="c:\uuu\vvv\www\xxx\aaa\index.html ... "

but i would prefer "<a href="..\..\aaa\index.html ... "

... a relative link, rather than an absolute link, i guess you would call it.

the biggest reason is that fully qualifying the drive:\and\each\directory\ in every link forces me to change all the html file links if i want to put all files and directory structure on a USB drive which is "d:\", or can be "e:/", or" f:/", or any other drive letter ... but never "c:\" and sometimes not the same as it was 3 bays before.

did this make sense ? am i nuts? 

 

 

 

  

Share this post


Link to post
Share on other sites
SlackerAl

What about

_PathGetRelative

?

  • Like 1

Problem solving step 1: Write a simple, self-contained, running, replicator of your problem.

Share this post


Link to post
Share on other sites
koffeeman

thank you, SlackerAl - this does exactly what i want.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×