M
^MisterJingo^
Hi all,
I've got a very small app which I want to read an xml config file which
is stored in the directory of the exe. To do this I am using the
following line of code:
XmlTextReader reader = new
XmlTextReader(System.IO.Directory.GetCurrentDirectory() +
"\\SDRApp.xml");
If I open a cmd window and type the path of the .exe file, I get an
error saying file cannot be found, it seems it is trying to look for
the file in the currently browsed folder of the cmd window (e.g. c:\).
If I traverse to the correct directory before executing the app, it all
works perfectly.
Should I be using another command other than
System.IO.Directory.GetCurrentDirectory() to get the directory the
application is executing from? This seems to look at where I am calling
the .exe from, rather than where the .exe is executing itself.
Thanks for any help.
I've got a very small app which I want to read an xml config file which
is stored in the directory of the exe. To do this I am using the
following line of code:
XmlTextReader reader = new
XmlTextReader(System.IO.Directory.GetCurrentDirectory() +
"\\SDRApp.xml");
If I open a cmd window and type the path of the .exe file, I get an
error saying file cannot be found, it seems it is trying to look for
the file in the currently browsed folder of the cmd window (e.g. c:\).
If I traverse to the correct directory before executing the app, it all
works perfectly.
Should I be using another command other than
System.IO.Directory.GetCurrentDirectory() to get the directory the
application is executing from? This seems to look at where I am calling
the .exe from, rather than where the .exe is executing itself.
Thanks for any help.