File Path

  • Thread starter Thread starter Hoop
  • Start date Start date
H

Hoop

Hi,
I have a c# app that will create and save a few files. I will not know
the directory name where the app will be installed. I would like the
files that the app creates to be in the installed directory.
I do I get the path where the app will be located?
Thanks
Jeff
 
Hoop said:
I have a c# app that will create and save a few files. I will not know
the directory name where the app will be installed. I would like the
files that the app creates to be in the installed directory.
I do I get the path where the app will be located?

Path.GetDirectoryName(Environment.GetCommandLineArgs()[0])

Arne
 
It's worth noting that this is not a recommended practice, as typically the
application will be installed to a location where the user does not have
permissions to write files. Either because they are a non-admin on XP or
have UAC on under Vista.

If the files you're creating are intended to be seen/manipulated by the
user, you can put them in a directory under My Documents
(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) or if
they are just for the application's use, you can put them in a directory
under AppData
(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData).

Josh Einstein
 
Hi,
I have a c# app that will create and save a few files. I will not know
the directory name where the app will be installed. I would like the
files that the app creates to be in the installed directory.
I do I get the path where the app will be located?
Thanks
Jeff



Hi,
Thanks for the quick answers. These all will help alot.
Jeff
 
Back
Top