This may only be relevant on OS X, but is there an easier way to get at the username of the person running the application ?
I want to persist a user preference file in /Users/*username*/Library/Application Support/*appname*/ but would need to extract the current username if I'm to do this and support multiple users.
Here's a workaround I've done but it's not ideal <grin>
Any ideas ?
I want to persist a user preference file in /Users/*username*/Library/Application Support/*appname*/ but would need to extract the current username if I'm to do this and support multiple users.
Here's a workaround I've done but it's not ideal <grin>
Local appUser:String = getOSXUser() Print appUser End ' ------------------------------------------------ ' Get OS X application user (in a roundabout way) ' ------------------------------------------------ Function getOSXUser:String() Local username:String = Null Local usersDir:String[] = LoadDir("/Users") ' iterate through each user dir For Local dirName:String = EachIn usersDir If Left(dirName,1) <> "." And dirName <> "Shared" ' *should* be a valid user dir ' try & change dir to a restricted dir dirIsReadable = ChangeDir("/Users/"+dirName+"/Library") If dirIsReadable username = dirName Exit End If End If Next Return username End Function
Any ideas ?