Revision: 12720
          http://sourceforge.net/p/skim-app/code/12720
Author:   hofman
Date:     2022-01-15 16:00:28 +0000 (Sat, 15 Jan 2022)
Log Message:
-----------
Move existing app presets to the front of the list

Modified Paths:
--------------
    trunk/SKSyncPreferences.m

Modified: trunk/SKSyncPreferences.m
===================================================================
--- trunk/SKSyncPreferences.m   2022-01-15 15:00:38 UTC (rev 12719)
+++ trunk/SKSyncPreferences.m   2022-01-15 16:00:28 UTC (rev 12720)
@@ -62,7 +62,16 @@
     SKINITIALIZE;
     
     NSURL *initialUserDefaultsURL = [[NSBundle mainBundle] 
URLForResource:INITIALUSERDEFAULTS_KEY withExtension:@"plist"];
-    TeXEditors = [[[NSDictionary 
dictionaryWithContentsOfURL:initialUserDefaultsURL] 
objectForKey:TEXEDITORS_KEY] copy];
+    NSMutableArray *editors = [NSMutableArray array];
+    NSWorkspace *ws = [NSWorkspace sharedWorkspace];
+    NSInteger i = 0;
+    for (NSDictionary *editor in [[NSDictionary 
dictionaryWithContentsOfURL:initialUserDefaultsURL] 
objectForKey:TEXEDITORS_KEY]) {
+        if ([ws fullPathForApplication:[editor objectForKey:NAME_KEY]])
+            [editors insertObject:editor atIndex:i++];
+        else
+            [editors addObject:editor];
+    }
+    TeXEditors = [editors copy];
 }
 
 - (void)dealloc {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to