how to get the path ?

  • Thread starter Thread starter Lloyd Dupont
  • Start date Start date
L

Lloyd Dupont

I try to do some shadow copying of plugins assembly on CF.
First I try to to get executing directory with

string exe = Assembly.GetExecutingAssembly().GetName().CodeBase;
string dir = Path.GetDirectoryName(exe);

later I try to find plugin with a given name

if(File.Exists(dir+'\\'+name+".dll"))
// something ...

unfortunately the later fail because the string return by CodeBase begins by
file://\ whih is not supported by the File.Exists() method.

I was wondering if there is any (CF) API call to remove the file://\ suffix
or if I should hard code it ?!
 
hi,

you can also try

string filelocation =
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetN
ame().CodeBase);

this will return something like

"Program Files\\Application\\"

cheers

james
 
Back
Top