title: Best way of getting path to "Application Data" directory?
body: <p>There are several possible ways of getting the path to the application data directory:</p>
  
  <ul>
  <li>using the <code>%APPDATA%</code> environment variable</li>
  <li>calling <code>SHGetFolderPath</code> with <code>CSIDL_APPDATA</code></li>
  </ul>
  
  <p>What is the best way to get the path from within an program? Are there any gotchas when I use the environment variable?</p>
  
  <p>Which method is safest across XP, Vista and upcoming versions?</p>