Determine the user at runtime
Is there a way to determine the current user at runtime?
I have many people using my scripts daily and I'm working on building a logging and error reporting API so that I can build detailed log files and accurately identify the source of errors. As part of this, I want to determine which user is currently running the script so i can log that information inside their log entry.
We're all running Macs here, so i need something that works on OSX. Currently I'm just reading the contents of the /Users/ folder (with folder.getFiles()) to find the user's name, but I'm hoping to find something a little more reliable. I can guarantee that each user has a folder in their /Users/ folder with their name on it. However, the /Users/ folder often contains other files and can contain multiple users (for example, i have a 'will.dowling' folder and an 'admin' folder).
I could eventually weed out all of the known undesirable names (.localized, DS Store, etc) but then i still leave myself open to the possibility that someone creates an unexpected file or directory in there.
tldr;
Is there anything in the adobe illustrator API that allows me to accurately read any unique information about the user so I can attach the username to the log file?
Thanks in advance. 😃