Wow! Where did you get that string from?
I couldn't find anything in the framework that could help optimize this file
name, so I wrote one by myself
Here it is...
static string OptimizeFilePat h(string filePath)
{
string[] parts =
filePath.Split( System.IO.Path. DirectorySepara torChar,
System.IO.Path. DirectorySepara torChar);
Stack stack = new Stack();
foreach (string folder in parts)
{
if (folder == "" || folder == ".")
continue;
if (folder == "..")
stack.Pop();
else
stack.Push(fold er);
}
StringBuilder optimizedPath = new StringBuilder() ;
foreach (string folder in stack)
{
optimizedPath.I nsert(0, folder);
optimizedPath.I nsert(0,
System.IO.Path. DirectorySepara torChar);
}
optimizedPath.R emove(0, 1);
return optimizedPath.T oString();
}
--
HTH
Stoitcho Goutsev (100)
<sh********@gma il.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
Hi All,
I call Assembly.LoadFr om("C:\\MyDir\\ MyAssembly.dll" )- it works fine.
However when I call the following, it fails:
Assembly.LoadFr om("C:\\MyDir\\ ..\\MyDir\\..\\ MyDir\\..\\MyDi r\\..\\MyDir\\. .\\MyDir\\
..\\MyDir\\..\\ MyDir\\..\\MyDi r\\..\\MyDir\\. .\\MyDir\\..\\M yDir\\..\\MyDir \\..\\MyDir\\.. \\MyDir\\..\\
MyDir\\..\\MyDi r\\..\\MyDir\\. .\\MyDir\\..\\M yDir\\..\\MyDir \\..\\MyDir\\.. \\MyDir\\..\\My Dir\\..\\
MyDir\\..\\MyDi r\\..\\MyDir\\. .\\MyDir\\..\\M yDir\\..\\MyDir \\..\\MyDir\\.. \\MyDir\\..\\My Dir\\..\\
MyDir\\..\\MyDi r\\MyAssembly.d ll")
Can someone tell me how can I get rid of it. Is there a way I can
compact the path before I pass it on to LoadFrom(string path).
Thanks,
Shrish