Revision: 13804
          http://sourceforge.net/p/skim-app/code/13804
Author:   hofman
Date:     2023-11-25 10:41:18 +0000 (Sat, 25 Nov 2023)
Log Message:
-----------
chekc for file type first before connecting

Modified Paths:
--------------
    trunk/SkimNotes/SKNSkimReader.m
    trunk/SkimNotes/SKNXPCSkimReader.m

Modified: trunk/SkimNotes/SKNSkimReader.m
===================================================================
--- trunk/SkimNotes/SKNSkimReader.m     2023-11-25 10:36:17 UTC (rev 13803)
+++ trunk/SkimNotes/SKNSkimReader.m     2023-11-25 10:41:18 UTC (rev 13804)
@@ -194,9 +194,6 @@
 }    
 
 - (BOOL)connectAndCheckTypeOfFile:(NSURL *)fileURL {
-    if (nil == connection)
-        [self establishConnection];
-    
     // these checks are client side to avoid connecting to the server unless 
it's really necessary
     NSWorkspace *ws = [NSWorkspace sharedWorkspace];
     NSString *fileType = [ws typeOfFile:[fileURL path] error:NULL];
@@ -204,9 +201,11 @@
     if (fileType != nil &&
         ([ws type:fileType conformsToType:(NSString *)kUTTypePDF] ||
          [ws type:fileType conformsToType:@"net.sourceforge.skim-app.pdfd"] ||
-         [ws type:fileType 
conformsToType:@"net.sourceforge.skim-app.skimnotes"]))
+         [ws type:fileType 
conformsToType:@"net.sourceforge.skim-app.skimnotes"])) {
+        if (nil == connection)
+            [self establishConnection];
         return YES;
-    
+    }
     return NO;
 }
 

Modified: trunk/SkimNotes/SKNXPCSkimReader.m
===================================================================
--- trunk/SkimNotes/SKNXPCSkimReader.m  2023-11-25 10:36:17 UTC (rev 13803)
+++ trunk/SkimNotes/SKNXPCSkimReader.m  2023-11-25 10:41:18 UTC (rev 13804)
@@ -177,9 +177,7 @@
 }
 
 - (BOOL)connectAndCheckTypeOfFile:(NSURL *)fileURL synchronous:(BOOL)sync {
-    if (nil == connection) {
-        [self establishSynchronousConnection:sync];
-    } else if (synchronous != sync) {
+    if (connection && synchronous != sync) {
         NSLog(@"attempt to mix synchronous and asynchronous skim notes 
retrieval");
         return NO;
     }
@@ -191,9 +189,11 @@
     if (fileType != nil &&
         ([ws type:fileType conformsToType:(NSString *)kUTTypePDF] ||
          [ws type:fileType conformsToType:@"net.sourceforge.skim-app.pdfd"] ||
-         [ws type:fileType 
conformsToType:@"net.sourceforge.skim-app.skimnotes"]))
+         [ws type:fileType 
conformsToType:@"net.sourceforge.skim-app.skimnotes"])) {
+        if (nil == connection)
+            [self establishSynchronousConnection:sync];
         return YES;
-    
+    }
     return NO;
 }
 

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to