GetCurrentDirectory in CF

R

Robert Hanson

I am trying to get the current directory in Compact Framework in order
to load a XML file loaded there. Is there a workaround for the
Directory.GetCurrentDirectory?

Thanks for any help!!

Bob Hanson
Centare Group Ltd.
 
M

Maarten Struys, eMVP

Windows CE does not have the concept of a current directory. What you can
get is the directory the app is running from, see:
http://www.opennetcf.org/Forums/topic.asp?TOPIC_ID=86. An easier method to
get the application's path is using the ApplicationEx.StartupPath property
that is available in OpenNETCF.org's Smart Device Framework.

Regards,
 
P

Paul G. Tobey [eMVP]

Windows CE has no concept of 'current directory', so .NET CF does not
either. You'll have to code the full directory path into anything that
needs a path.

Paul T.
 
F

Fred Pizarro

Try this ...

string sPath = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName );
 
C

Chris Tacke, eMVP

You should use GetCallingAssembly, not GetExecutingAssembly becasue if you
put this in a DLL that ends up in the \Windows folder, you'll always get t
\Windows as the path.

--
Chris Tacke, eMVP
Co-Founder and Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net


Fred Pizarro said:
Try this ...

string sPath = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName );

Robert Hanson said:
I am trying to get the current directory in Compact Framework in order
to load a XML file loaded there. Is there a workaround for the
Directory.GetCurrentDirectory?

Thanks for any help!!

Bob Hanson
Centare Group Ltd.
 

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