[Mono-dev] System.Environment.CurrentDirectory problem

PFJ pjohnson1 at uclan.ac.uk
Thu Jul 23 12:18:36 EDT 2009


Hi,

I've compiled an application which tests for a directory and if it doesn't
exist, creates it and copies a configuration file over.

The app compiles fine. I've copied the executable and the configuration
directory/file over to a new directory. When I run the app though, it
creates a new directory in /home/paul rather than the directory it is being
run from.

When I've added in some debugging code, it seems that it think that the
currentdirectory is /home/paul and not /home/paul/marker.

I'm using the following code which seems to be misbehaving!

8-->
			string path = System.Environment.CurrentDirectory;
			string sep = Path.DirectorySeparatorChar.ToString();
			string dirpath = path + string.Format("{0}Resources", sep);
			string final = dirpath + string.Format("{0}configure.xml", sep);
		
			DialogResult ress;
			ress = MessageBox.Show(this, path, "create - path",
MessageBoxButtons.OK);
			ress = MessageBox.Show(this, dirpath, "create - dir",
MessageBoxButtons.OK);
			
			if (!Directory.Exists(dirpath))
			{
				ress = MessageBox.Show(this, "Directory no exist", "create",
MessageBoxButtons.OK);
				Directory.CreateDirectory(dirpath);
			}
<--8

path is only returning /home/paul which isn't the expected behaviour. Is
anyone else seeing this or is it me?

I'm using mono-2.4.2.2

TTFN

Paul
-- 
View this message in context: http://www.nabble.com/System.Environment.CurrentDirectory-problem-tp24629353p24629353.html
Sent from the Mono - Dev mailing list archive at Nabble.com.



More information about the Mono-devel-list mailing list