how to get the path ?

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 ?!
 
W

Whitetiger

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top