CurrentDir

  • Thread starter Thread starter Alessandro
  • Start date Start date
A

Alessandro

There is a way to see complete path of appication ?
I need to reed and write xml file on a specific directory, but i'm not able
because i can't get the current path of my application.
 
IO.Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)

Hope this helps
 
Ok, the code is ok...

But the problem is unsolved.....
I have an application project witha a directory "configuration" with some
files...
When i debug the application

IO.Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly().GetName(
).CodeBase)
give me the current path, but if i do:

Path =
System.IO.Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly().G
etName().CodeBase)
Path = Path & "\Configuration"
If System.IO.Directory.Exists(Path ) Then

End If

the function System.IO.Directory.Exists(Path ) return false.........
 
Well, no offence, but I assume the directory is there on the PDA to
begin with?

Also, what do you get if you check the path value after the append in
the debugger?

As an aside, the following syntax is better for string appending (or
insertion for that matter, I think):

Path.Insert(Path.Length, "\Configuration")

This is because if you do :

Path= Path & "\Configuration"

the Path veriable is destroyed and then re-created.
 
Ok, the real problem is that Visual Studio puts into the emulator only the
file.exe, and a file XML ( which is into a directory "configuration" of the
project) is copyed in the same directory of file exe, and not in the
directory "Configuration".......

I havo done some error, but i'm not able to recreate on the client this
directory and its files when i try to debug the applicaion... I must tho
something to do this, but i don't know what......
 
I feel I must correct myself - before someone else does, but in a more
brutal fashion.

The insert method is fine, but to append one string to another use:

String1 += String2
 
try this one:
Path += @"\Configuration";

or

Path += "\\Configuration";

greets
sascha
 
Back
Top