Razor-qt/razor-qt — comment on commit fb135bae06f080bd801fe3b8b82cd7c99a8bcb53
File: librazorqt/qtxdg/xdgdesktopfile.cpp line 759
By Adys:

I'm not sure tilde expansion is done within .desktop files, as Bash is the one doing that. Did you check?
If it's done, this right here won't do. It will expand improper tildes, and it will not support tildes for other users (ie. ~user/foo)

As for env variables, you're only checking for home. You'll want to check for any variable in there.