mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
mate: disable untitled document via user defaults
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.
This commit is contained in:
@@ -165,10 +165,8 @@ BOOL HasDocumentWindow (NSArray* windows)
|
||||
D(DBF_AppController, bug("\n"););
|
||||
|
||||
BOOL disableUntitledAtStartupPrefs = [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsDisableNewDocumentAtStartupKey];
|
||||
disableUntitledAtStartupPrefs = disableUntitledAtStartupPrefs || getenv("OAK_DISABLE_UNTITLED_FILE") != NULL;
|
||||
if(!disableUntitledAtStartupPrefs && !HasDocumentWindow([NSApp orderedWindows]))
|
||||
[self newDocument:self];
|
||||
unsetenv("OAK_DISABLE_UNTITLED_FILE");
|
||||
|
||||
OakSubmitNewCrashReportsInBackground(REST_API @"/crashes");
|
||||
[BundlesManager sharedInstance]; // trigger periodic polling of remote bundle index
|
||||
|
||||
@@ -82,11 +82,9 @@ static void launch_app ()
|
||||
if(!find_app(&appFSRef, NULL))
|
||||
abort();
|
||||
|
||||
std::map<std::string, std::string> tmp;
|
||||
tmp["OAK_DISABLE_UNTITLED_FILE"] = "YES";
|
||||
cf::dictionary_t environment(tmp);
|
||||
cf::array_t args(std::vector<std::string>{ "-disableNewDocumentAtStartup", "1" });
|
||||
|
||||
struct LSApplicationParameters const appParams = { 0, kLSLaunchDontAddToRecents|kLSLaunchDontSwitch|kLSLaunchAndDisplayErrors, &appFSRef, NULL, environment, NULL, NULL };
|
||||
struct LSApplicationParameters const appParams = { 0, kLSLaunchDontAddToRecents|kLSLaunchDontSwitch|kLSLaunchAndDisplayErrors, &appFSRef, NULL, NULL, args, NULL };
|
||||
OSStatus err = LSOpenApplication(&appParams, NULL);
|
||||
if(err != noErr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user