Reputation: 25038
In vb.net I get the path
"C:\Users\MyUser\AppData\Local\MyApp\My\1.1.0.0"
using:
Dim vbPath As [String] = Application.LocalUserAppDataPath
In c# I am using:
string csPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
but I am getting
"C:\\Users\\MyUser\\AppData\\Roaming"
I get Roaming instead of local folder, What Am I doing wrong?
Upvotes: 1
Views: 3457
Reputation: 11063
You can also use:
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
it represents the system global variable %AppData%
Upvotes: 1
Reputation: 20464
There is a difference between ApplicationData directory and LocalApplicationData directory.
What you want is:
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
UPDATE:
If you want to know which is the default local application directory then you must use this:
Application.LocalUserAppDataPath
If you want to customize the directory location then you can do this else:
Dim CustomLocalAppDataPath As String = _
IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "MyApp\My\1.1.0.0")
Upvotes: 3