GetCurrentDirectory() doesn't work

  • Thread starter Thread starter Kwok-ho
  • Start date Start date
K

Kwok-ho

Dear all,

I have an XML file in the same directory of the executable file. Therefore I
use Directory.GetCurrentDirectory() method to get the current directory, so
that I can open the XML in that directory. However, I got a
NotSupportedException when calling the method. I have read the MSDN, the
method is supported by the compact framework, so I don't know why it doesn't
work. Can anyone give me some suggestion?

Thanks,
Kwokho.
 
That's an FAQ. Windows CE does not support the concept of current directory.
On this page[1] it says

..NET Compact Framework Platform Note: The .NET Compact Framework does not
support GetCurrentDirectory because current directory functionality is not
used in devices running Windows CE .NET.

For application directory use
C#
Path.GetDirectory(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
VB
Path.GetDirectory(Assembly.GetExecutingAssembly().GetModules()(0).FullyQualifiedName)

[1]
http://msdn.microsoft.com/library/d...miodirectoryclassgetcurrentdirectorytopic.asp
 
Thanks

Alex Feinman said:
That's an FAQ. Windows CE does not support the concept of current
directory. On this page[1] it says

.NET Compact Framework Platform Note: The .NET Compact Framework does not
support GetCurrentDirectory because current directory functionality is not
used in devices running Windows CE .NET.

For application directory use
C#
Path.GetDirectory(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
VB
Path.GetDirectory(Assembly.GetExecutingAssembly().GetModules()(0).FullyQualifiedName)

[1]
http://msdn.microsoft.com/library/d...miodirectoryclassgetcurrentdirectorytopic.asp

--
Alex Feinman
---
Visit http://www.opennetcf.org
Kwok-ho said:
Dear all,

I have an XML file in the same directory of the executable file.
Therefore I use Directory.GetCurrentDirectory() method to get the current
directory, so that I can open the XML in that directory. However, I got a
NotSupportedException when calling the method. I have read the MSDN, the
method is supported by the compact framework, so I don't know why it
doesn't work. Can anyone give me some suggestion?

Thanks,
Kwokho.
 
Back
Top