Revision: 4246
http://skim-app.svn.sourceforge.net/skim-app/?rev=4246&view=rev
Author: hofman
Date: 2008-07-18 09:50:36 +0000 (Fri, 18 Jul 2008)
Log Message:
-----------
Correct way to find Skim app. Reorder code
Modified Paths:
--------------
trunk/SkimNotes/SKNAgentListener.m
trunk/SkimNotes/SKNSkimReader.m
Modified: trunk/SkimNotes/SKNAgentListener.m
===================================================================
--- trunk/SkimNotes/SKNAgentListener.m 2008-07-17 20:58:52 UTC (rev 4245)
+++ trunk/SkimNotes/SKNAgentListener.m 2008-07-18 09:50:36 UTC (rev 4246)
@@ -75,6 +75,33 @@
[super dealloc];
}
+- (void)destroyConnection;
+{
+ [connection registerName:nil];
+ [[connection receivePort] invalidate];
+ [[connection sendPort] invalidate];
+ [connection invalidate];
+ [connection release];
+ connection = nil;
+}
+
+- (void)portDied:(NSNotification *)notification
+{
+ [self destroyConnection];
+ fprintf(stderr, "skimnotes agent pid %d dying because port %s is
invalid\n", getpid(), [[[notification object] description] UTF8String]);
+ exit(0);
+}
+
+// first app to connect will be the owner of this instance of the program;
when the connection dies, so do we
+- (BOOL)makeNewConnection:(NSConnection *)newConnection sender:(NSConnection
*)parentConnection
+{
+ [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(portDied:) name:NSPortDidBecomeInvalidNotification
object:[newConnection sendPort]];
+ fprintf(stderr, "skimnotes agent pid %d connection registered\n",
getpid());
+ return YES;
+}
+
+#pragma mark SKNAgentListenerProtocol
+
- (bycopy NSData *)SkimNotesAtPath:(in bycopy NSString *)aFile;
{
NSError *error = nil;
@@ -103,29 +130,4 @@
return [string dataUsingEncoding:encoding];
}
-- (void)destroyConnection;
-{
- [connection registerName:nil];
- [[connection receivePort] invalidate];
- [[connection sendPort] invalidate];
- [connection invalidate];
- [connection release];
- connection = nil;
-}
-
-- (void)portDied:(NSNotification *)notification
-{
- [self destroyConnection];
- fprintf(stderr, "skimnotes agent pid %d dying because port %s is
invalid\n", getpid(), [[[notification object] description] UTF8String]);
- exit(0);
-}
-
-// first app to connect will be the owner of this instance of the program;
when the connection dies, so do we
-- (BOOL)makeNewConnection:(NSConnection *)newConnection sender:(NSConnection
*)parentConnection
-{
- [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(portDied:) name:NSPortDidBecomeInvalidNotification
object:[newConnection sendPort]];
- fprintf(stderr, "skimnotes agent pid %d connection registered\n",
getpid());
- return YES;
-}
-
@end
Modified: trunk/SkimNotes/SKNSkimReader.m
===================================================================
--- trunk/SkimNotes/SKNSkimReader.m 2008-07-17 20:58:52 UTC (rev 4245)
+++ trunk/SkimNotes/SKNSkimReader.m 2008-07-18 09:50:36 UTC (rev 4246)
@@ -91,7 +91,8 @@
}
if (path == nil) {
// look for it in the Skim bundle
- path = [[[NSBundle
bundleWithIdentifier:@"net.sourceforge.skim-app.skim"] sharedSupportPath]
stringByAppendingPathComponent:@"skimnotes"];
+ NSString *SkimPath = [[NSWorkspace sharedWorkspace]
fullPathForApplication:@"Skim"];
+ path = SkimPath ? [[[NSBundle bundleWithPath:SkimPath]
sharedSupportPath] stringByAppendingPathComponent:@"skimnotes"] : nil;
}
return path;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit