Revision: 4234
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4234&view=rev
Author:   hofman
Date:     2008-07-17 09:23:43 +0000 (Thu, 17 Jul 2008)

Log Message:
-----------
Check other dvi conversion tools.

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

Modified: trunk/SKPSProgressController.m
===================================================================
--- trunk/SKPSProgressController.m      2008-07-17 00:01:54 UTC (rev 4233)
+++ trunk/SKPSProgressController.m      2008-07-17 09:23:43 UTC (rev 4234)
@@ -278,23 +278,27 @@
     
     if (dviToolPath == nil) {
         NSString *commandPath = [[NSUserDefaults standardUserDefaults] 
stringForKey:SKDviConversionCommandKey];
-        NSString *commandName = commandPath ? [commandPath lastPathComponent] 
: @"dvipdfmx";
-        NSArray *paths = [NSArray arrayWithObjects:@"/usr/texbin", 
@"/usr/local/teTeX/bin/powerpc-apple-darwin-current", @"/sw/bin", 
@"/opt/local/bin", @"/usr/local/bin", nil];
-        int i = 0, count = [paths count];
+        NSString *commandName = commandPath ? [commandPath lastPathComponent] 
: nil;
+        NSArray *paths = [NSArray arrayWithObjects:@"/usr/texbin", 
@"/usr/local/gwTeX/bin/powerpc-apple-darwin-current", 
@"/usr/local/gwTeX/bin/i386-apple-darwin-current", @"/sw/bin", 
@"/opt/local/bin", @"/usr/local/bin", nil];
+        int i = 0, iMax = [paths count];
         NSFileManager *fm = [NSFileManager defaultManager];
-        NSSet *supportedTools = [NSSet setWithObjects:@"dvips", @"dvipdfmx", 
@"dvipdfm", @"dvipdf", nil];
+        NSArray *supportedTools = [NSArray arrayWithObjects:@"dvipdfmx", 
@"dvipdfm", @"dvipdf", @"dvips", nil];
+        NSEnumerator *toolEnum = [supportedTools objectEnumerator];
         
-        NSAssert1([supportedTools containsObject:commandName], @"DVI converter 
%@ is not supported", commandName);
-        if ([supportedTools containsObject:commandName]) {
+        NSAssert1(commandName == nil || [supportedTools 
containsObject:commandName], @"DVI converter %@ is not supported", commandName);
+        if (commandPath == nil || [supportedTools containsObject:commandName] 
== NO)
+            commandPath = [toolEnum nextObject];
+        do {
+            i = 0;
             while ([fm isExecutableFileAtPath:commandPath] == NO) {
-                if (i >= count) {
+                if (i >= iMax) {
                     commandPath = nil;
                     break;
                 }
                 commandPath = [[paths objectAtIndex:i++] 
stringByAppendingPathComponent:commandName];
             }
-            dviToolPath = [commandPath retain];
-        }
+        } while (commandPath == nil && (commandName = [toolEnum nextObject]));
+        dviToolPath = [commandPath retain];
     }
     
     return dviToolPath;


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

Reply via email to