Find directory of the file

Find directory of the file

Post by dais » Fri, 10 Oct 2003 16:03:11


My file my.txt is available in

When I give System.Environment.CurrentDirectory, I get the
path as D:\bkup\FilesOnline\dotnet\NextSet\817
I want at run time I should get the path as
i.e. without the bin directory. Is there any method to
obtain that ?


Find directory of the file

Post by mike » Fri, 10 Oct 2003 17:15:59


no you should try another approach:
D:\bkup\FilesOnline\dotnet\NextSet\817\XSLTSample is only
your DEVELOP folder, this *IS NOT* the runtime folder.
These are 2 different folders.
so if you want your application (at release time) to load
a file from its current directory, you are already right,
you just should copy your txt file to \bin\debug because
the running exe DOES NOT KNOW (and can't know of course)
where it's source files are contained.
you do not *want* to get the path information without
the approach should be to imagine how the program shall
behave outside devenv. it shall load from its current
directory, right?
so \bin\debug IS the current directory.

i'm not a native speaker but i hope u can understand what
i mean

cheers, mike