Luke
Luke

Reputation: 18993

How do I get the current user's Local Settings folder path in C#?

I want to point a file dialog at a particular folder in the current user's Local Settings folder on Windows. What is the shortcut to get this path?

Upvotes: 23

Views: 34815

Answers (3)

nawfal
nawfal

Reputation: 73311

string localPath = Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)).FullName;

is the simple answer.

Upvotes: 2

Darren Kopp
Darren Kopp

Reputation: 77697

Environment.GetFolderPath( Environment.SpecialFolders.LocalApplicationData);?

I can't remember if there is a "Local Settings" folder on Windows XP anymore, it seems vaguely familiar.

Upvotes: 1

Matthew Maravillas
Matthew Maravillas

Reputation: 3182

How about this, for example:

String appData = 
    Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

I don't see an enum for just the Local Settings folder.

http://web.archive.org/web/20080303235606/http://dotnetjunkies.com/WebLog/nenoloje/archive/2007/07/07/259223.aspx has a list with examples.

Upvotes: 35

Related Questions