Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting current directory in Windows CE 5.0 using C# compact 2.0

How do I get the current directory from which my EXE is running? I have tried the following two codes but they don't work.

Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);

Using above I get error "The name "Assembly" does not exist..."

Directory.GetCurrentDirectory()

also doesn't work.

EDIT
Ok I found another code that works but it is giving me directory "\Windows" but my program is running from an SD Card. I copied the program to "Program Files" folder on device but it again gave me directory "\Windows".

How do I get the current directory or more specifically how do I get SD Card/Flash Memory path?

like image 774
Ali Avatar asked Dec 13 '12 06:12

Ali


1 Answers

Problem solved by using:

System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;
like image 140
Ali Avatar answered Oct 13 '22 06:10

Ali