1

Possible Duplicate:
C# getting the path of %AppData%

I am trying to use StreamReader to open up a path in the form of %appdata%/folder/file.txt. All my attempts have ended up in a file not found exception. Is there a way I can open up this type of path or otherwise determine the actual location that it points to?

Community
  • 1
  • 1
Lunyx
  • 3,164
  • 6
  • 30
  • 46

2 Answers2

2

Try that:

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/folder/file.txt";
Amiram Korach
  • 13,056
  • 3
  • 28
  • 30
0

In .NET .instead of using %appdata% use System.Environment.SpecialFolders.ApplicationData

string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
David
  • 72,686
  • 18
  • 132
  • 173