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,014
  • 6
  • 25
  • 44

2 Answers2

2

Try that:

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/folder/file.txt";
Amiram Korach
  • 12,646
  • 3
  • 26
  • 28
0

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

string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
David
  • 70,778
  • 16
  • 128
  • 169