A question about using relative paths in my windows application

  • Thread starter Thread starter Simon Harvey
  • Start date Start date
S

Simon Harvey

Hi everyone,

This is probably a pretty stupid question but does anyone know if its
possible to use relative addressing when it comes to accessing an image of
the file system?

In particular, I am making a simple application that needs to load a
treeview with icons. The icons are stored in a folder called icons under the
application's directory. (The folder exists in the same dir as the bin
folder and the debug folder)

The only way I can get the image to work is to put in the whole address.

Is it possible to use a relative address? Like just \icons or something? Is
it a good idea to do this?

I'm just trying to think ahead to what it would take to deploy this
application. (Not that I'm going to). I would need some sort of generic
address mechanism and of course Absolute Addressing is not at all generic.

Any advice would be greatfully recevied.

Simon
 
Hi Simon,

Yes, you should use relative address.
However, you have to create full path string when needed.
Root path (where exe is located) is stored in Application.StartupPath.
So, to find icons, you'll use path (in C# there is double blackslash)
Application.StartupPath+\\icons
 
Back
Top