[RESOLVED] Getting path of %AppData%
Hello,
I am using this code below:
Code:
dt.ReadXml("%AppData%\DateLinks.xml")
However, I am getting an exception that point to the location of where my application is running from:
Code:
Could not find a part of the path 'D:\Projects\SubVersionProjects\CatDialer\bin\Debug\%AppData%\DateLinks.xml'.
I thought the %AppData% should find the relative path. When I go 'Start|Run|%AppData% windows explorer takes me to that directory.
I can not put the full path in, as the user is different on each client machine.
Many thanks for any advice,
Re: Getting path of %AppData%
That's an environment variable and ReadXml has no knowledge of environment variables. I believe that the Path class can expand environment variables for you but in this case just look at the Environment.GetFolderPath method.
Re: Getting path of %AppData%
Thanks,
vb Code:
Dim path As String = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "DataLinks.xml")