Browse code

Make built-in mulle-scion a fallback option. So you are editing with the system wide executable if possible. Add some rudimentary error output.

Nat! authored on 23/11/2013 16:55:40
Showing 1 changed files
... ...
@@ -162,13 +162,14 @@
162 162
    NSPropertyListFormat   format;
163 163
    NSString               *cmdString;
164 164
    NSString               *mulleScionPath;
165
+   NSString               *mulleScionDirPath;
165 166
    NSString               *plistPath;
166 167
    id                     plist;
167 168
    
168
-   bundle         = [NSBundle mainBundle];
169
+   bundle = [NSBundle mainBundle];
169 170
    //   catPath        = [bundle pathForResource: @"cat2html" ofType: NULL];
170
-   mulleScionPath = [bundle pathForResource: @"mulle-scion" ofType: NULL];
171
-   
171
+   mulleScionPath    = [bundle pathForResource: @"mulle-scion" ofType: NULL];
172
+   mulleScionDirPath = [mulleScionPath stringByDeletingLastPathComponent];
172 173
    
173 174
    plistPath = @"none";
174 175
    if( [plistString length])
... ...
@@ -179,7 +180,10 @@
179 179
                                                          format:&format
180 180
                                                           error:&error];
181 181
       if( ! plist)
182
+      {
183
+         NSLog( @"plist error: %@", error);
182 184
          return( nil);
185
+      }
183 186
       
184 187
       plistPath = [plist objectForKey:@"__BUNDLE__"];
185 188
       if( ! plistPath)
... ...
@@ -191,8 +195,12 @@
191 191
    
192 192
    [s writeToFile: @"/tmp/MulleScionDrakeTemp.scion" atomically: YES encoding: NSUTF8StringEncoding error: NULL];
193 193
    
194
-// generate command string to create html from man text using nroff and cat2html
195
-   cmdString = [NSString stringWithFormat: @"%@ /tmp/MulleScionDrakeTemp.scion %@ > /tmp/MulleScionDrakeTemp.html", mulleScionPath, plistPath];
194
+   //
195
+   // generate command string to create html from scion text using mulle-scion
196
+   // give preference to "OS" mulle-scion, using included mulle-scion only as
197
+   // a fallback
198
+   //
199
+   cmdString = [NSString stringWithFormat: @"PATH=\"$PATH:%@\" mulle-scion /tmp/MulleScionDrakeTemp.scion %@ > /tmp/MulleScionDrakeTemp.html", mulleScionDirPath, plistPath];
196 200
    return( cmdString);
197 201
 }
198 202
 
... ...
@@ -350,7 +358,15 @@
350 350
          plist = [self openBundle:url];
351 351
       }
352 352
    
353
+
354
+   if( ! plist)
355
+   {
356
+      NSRunAlertPanel(@"Load Error", @"failed to load dataSource", @"OK", nil, nil);
357
+      return;
358
+   }
359
+   
353 360
    [plistTextView setString:[plist description]];
361
+   [self refresh:self];
354 362
 }
355 363
 
356 364
 @end