Relative path to absolute path in C#? -


i have xml files contain href file paths images (e.g. "....\images\image.jpg"). hrefs contain relative paths. now, need extract hrefs images , turn them absolute paths in file system.

i know getfullpath method, tried , seems work currentdirectory set, appears c: don't see how use that. , still, have absolute path of file containing hrefs, , href relative paths, since simple task me count number of "....\" parts based on absolute path of containing file, seems there must way programmatically well.

i'm hoping there's simple method don't know about! ideas?

assuming know real directory xml file lives in use path.combine, e.g.

var absolute_path = path.combine(directoryxmllivesin, "..\images\image.jpg"); 

if want full path ..'s collapsed can use:

path.getfullpath((new uri(absolute_path)).localpath); 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -