Search code examples
lispappdataautolisp

AutoLisp - Find AppData


I'm having trouble in finding AppData with the parent folder. Originally, my plan was to pull the username, use it to get to C:\Users\[User]\AppData\Roaming\DraftSight, and create a text file with the few variables needed for the add-in. However, I've run into an issue where neither the results of (getenv "LoginName") and (getenv "UserName") match the name of the parent directory of AppData.

On my quest to find an alternative way to find AppData, I found information in a website, AfraLisp, where it shows how to use setcfg and getcfg in AutoLisp, but the results I receive from these commands is nil. These commands save this information in a file called AppData.ini, but I'm not sure where it is located.

Questions

  1. How do does my add-in need to be able to access the AppData directory?
  2. Where is the AppData.ini file located? Is this file still in use?

Website References:


Solution

  • I am still clueless with the AppData.ini file, but this question contained the answer I was looking to find in regards to the first question. Simply use (getenv [Input]) with the names below to receive their respective file paths.

    1. (getenv "APPDATA") ----------> "C:\Users\AppData\Roaming"
    2. (getenv "LOCALAPPDATA") -----> "C:\Users\AppData\Local"
    3. (getenv "ALLUSERSPROFILE") --> "C:\ProgramData"