There are any Path or Directory function to convert an absolute path to a relative path?

There are any Path or Directory function to convert an absolute path to a relative path?

Post by Ffelagun » Sun, 07 Mar 2004 06:34:36


There are any Path or Directory function to convert an absolute path to
a relative path using a choiced directory as base to calculate the
origin of the relative path?
 
 
 

1. how to judge whether a path is relative path or absolute path

2. Converting a relative path to an absolute path

Outer problem: I have an app that only works if fed a full path to the file.
It will not work with a relative path (known, documented limitation in
the app)

So, I setup a shell alias to call the app, prepending the value of $PWD
to the filename argument passed. This works fine - especially in the most
common use case, which is passing in a simple file name (to invoke the
app on a file in the current directory) - but I have a couple of niggling
issues with this:

1) It won't work right if I happen to invoke the alias with an absolute
path. Because then, the app would get something like:
/path/to/here/path/from/root/file
So, it would be nice to plug this small hole.

2) I'm just curious if there is a better, more built-in way to do
this - some shell tool (something along the lines of basename)
maybe.

--
Just for a change of pace, this sig is *not* an obscure reference to
comp.lang.c...

3. Re[2]: convert relative path into absolute path via wxFileName::Normalize

4. How do I convert an absolute path into a relative path

5. convert relative path into absolute path via wxFileName::Normalize

6. Absolute paths relative to basic-url instead of relative paths as usual

7. absolute path to relative path in a function

8. convert relative paths to site root relative path?

9. PHP: convert relative paths to site root relative path?

10. how to change absolute path to relative path

11. Dynamically replacing relative path hyperlink with absolute path

12. Only Use Absolute Paths, Disable Relative Paths

13. Help with Absolute path vs. Relative path

14. Relative path vs. absolute path possible in storing pictures?

15. How to turn a relative path into an absolute path?