To get the path to the currect user's desktop I am using:
set posPath to POSIX path of ((path to desktop from user domain) as string)
It has always worked accurately that I know of. Recently, I heard from a correspondent who had a problem with a script of mine that uses this snippet. He was getting an error to the effect:
Can't make «class psfx» "Users/Bob/Desktop/" into type string
It turns out his home folder is actually named "Bob123", not "Bob", so of course there is no such path. Indeed, he had changed the shortname to "Bob123" but the username was still Bob. He confirmed this for me via the Advanced Options in Accounts Preferences.
On my computer, I am user "Doug Adams", with a shortname of "dougadams", and the above snippet finds my desktop folder just fine.
I am wondering what it could be that is causing the snippet to return an erroneous result on Bob's computer? I realise that there may or may not be an obvious answer especially since I don't know what else to suspect on Bob's computer.
Secondly, should I just build the path to the desktop using "short name" from system info? Would that be accurate each time, or do you suppose the same weirdness is affecting system info as well?