This is instead of setting an environment variable. Since there already is a user defaults setting for whether or not we want an untitled document created at startup, it seems nicer to have mate set that, instead of effectively introducing an alias for the setting.
Since we now use the (numeric) user ID as part of TextMate’s named socket (to allow multiple users on the same system to each run an instance of TextMate), mate needs to know this.
Running ‘mate’ via ‘sudo’ has getuid() return zero (root), hence why we need to specifically handle this.
We moved it to TMPDIR so that multiple instances of TextMate could run (for different users) but have since gotten a lot of reports about problems with this location. The short version is that ‘ls’ shows the socket exists (in TMPDIR), but stat’ing it or similar will fail.
To still allow different users to use mate side-by-side we add the user ID to the socket name.
Hopefully this closes issue #183.
We have TextMate create a named socket that ‘mate’ can use to contact the main application. Previously it was hardcoded to ‘/tmp/avian.sock’ which is bad on a multi-user system.
Placing it in the user’s temporary directory should ensure it doesn’t clash, yet still give us a predictable path (for mate to use).
Presently we maintain the old socket path as a link to the new location so that old versions of mate will still work.