Converting absolute path to relative
by Dmitry Shaporenkov » Sat, 27 Sep 2003 01:55:49 GMT
Hi,
assume I have two paths referring to files on the same
logical volume, like "C:\Home\Dir1\file1.txt"
and "C:\Home\Dir2\file2.txt". How can I convert the
second absolute path to a relative path based on the
first one, like "..\Dir2\file2.txt"? I'm looking into the
System.IO.Path class but can't find an answer...
Thanks in advance,
Dmitry
Similar Threads:
1.How to chage Absolute url to relative url ,and relative url to absolute url
How to chage Absolute url to relative url ,and relative
url to absolute url
2.why relative hint path but absolute reference path
I have a vs.net 2002 solution that contains a number of projects
All projects are created in folders under the solution folder.
The idea here is that this entire solution should be 'moveable' ie. copied
to and useable from a new directory or computer.
And it almost is.
One project makes reference to an existing .net dll that also exists in a
folder under the solution folder.
The project file shows a relative hint path to the dll ie
"..\..\dllFolder\my.dll"
If I move the solution to a new folder and the open solution from the new
location, the dll can no longer be found. if i restore the original
solution folder, the dll is once again found. so obviously, although the
project file includes a relative hint path, vs.net is in fact looking for
the dll at an absolute location. This is causing headaches as this solution
cannot be 'passed around' without re-adding the reference to this dll.
is there some setting somewhere to get the relative path used ?
there does not seem to be any problem using relative project references - is
there some trick using a dummy project to get this to work ?
gerry
3.Get machine name path from relative or absolute path
Hello, is it possible in C#.Net to get a path to a file in the form
"\\Spain\Madrid\readme.txt" from a relative path i.e "readme.txt" or
from a absolute path in the following form "C:\Madrid\readme.txt" where
"Spain" is the name of the machine that the file is on? Thanks in
advance.
4.absolute path to relative path conversion
5.why relative hint path but absolute reference path
I have a vs.net 2002 solution that contains a number of projects
All projects are created in folders under the solution folder.
The idea here is that this entire solution should be 'moveable' ie. copied
to and useable from a new directory or computer.
And it almost is.
One project makes reference to an existing .net dll that also exists in a
folder under the solution folder.
The project file shows a relative hint path to the dll ie
"..\..\dllFolder\my.dll"
If I move the solution to a new folder and the open solution from the new
location, the dll can no longer be found. if i restore the original
solution folder, the dll is once again found. so obviously, although the
project file includes a relative hint path, vs.net is in fact looking for
the dll at an absolute location. This is causing headaches as this solution
cannot be 'passed around' without re-adding the reference to this dll.
is there some setting somewhere to get the relative path used ?
there does not seem to be any problem using relative project references - is
there some trick using a dummy project to get this to work ?
gerry
6. Absolute or Relative path?
7. Relative & absolute path question (JavaScript, mostly)
8. User controls --> Relative/Absolute Paths