Diff of /Mac/OSX/PythonLauncher/FileSettings.m [c840c5] .. [ca568f] Maximize Restore

Repo status: analyzing...

  Switch to unified view

a/Mac/OSX/PythonLauncher/FileSettings.m b/Mac/OSX/PythonLauncher/FileSettings.m
...
...
205
            [NSNumber numberWithBool: debug], @"debug",
205
            [NSNumber numberWithBool: debug], @"debug",
206
            [NSNumber numberWithBool: verbose], @"verbose",
206
            [NSNumber numberWithBool: verbose], @"verbose",
207
            [NSNumber numberWithBool: inspect], @"inspect",
207
            [NSNumber numberWithBool: inspect], @"inspect",
208
            [NSNumber numberWithBool: optimize], @"optimize",
208
            [NSNumber numberWithBool: optimize], @"optimize",
209
            [NSNumber numberWithBool: nosite], @"nosite",
209
            [NSNumber numberWithBool: nosite], @"nosite",
210
            [NSNumber numberWithBool: nosite], @"nosite",
210
            [NSNumber numberWithBool: tabs], @"tabs",
211
            others, @"others",
211
            others, @"others",
212
            scriptargs, @"scriptargs",
212
            scriptargs, @"scriptargs",
213
            [NSNumber numberWithBool: with_terminal], @"with_terminal",
213
            [NSNumber numberWithBool: with_terminal], @"with_terminal",
214
            nil];
214
            nil];
215
        defaults = [NSUserDefaults standardUserDefaults];
215
        defaults = [NSUserDefaults standardUserDefaults];
...
...
233
    if (value) inspect = [value boolValue];
233
    if (value) inspect = [value boolValue];
234
    value = [dict objectForKey: @"optimize"];
234
    value = [dict objectForKey: @"optimize"];
235
    if (value) optimize = [value boolValue];
235
    if (value) optimize = [value boolValue];
236
    value = [dict objectForKey: @"nosite"];
236
    value = [dict objectForKey: @"nosite"];
237
    if (value) nosite = [value boolValue];
237
    if (value) nosite = [value boolValue];
238
    value = [dict objectForKey: @"nosite"];
238
    value = [dict objectForKey: @"tabs"];
239
    if (value) tabs = [value boolValue];
239
    if (value) tabs = [value boolValue];
240
    value = [dict objectForKey: @"others"];
240
    value = [dict objectForKey: @"others"];
241
    if (value) others = [value retain];
241
    if (value) others = [value retain];
242
    value = [dict objectForKey: @"scriptargs"];
242
    value = [dict objectForKey: @"scriptargs"];
243
    if (value) scriptargs = [value retain];
243
    if (value) scriptargs = [value retain];
244
    value = [dict objectForKey: @"with_terminal"];
244
    value = [dict objectForKey: @"with_terminal"];
245
    if (value) with_terminal = [value boolValue];
245
    if (value) with_terminal = [value boolValue];
246
}
246
}
247
247
248
- (NSString*)_replaceSingleQuotes: (NSString*)string
249
{
250
  /* Replace all single-quotes by '"'"', that way shellquoting will
251
   * be correct when the result value is delimited  using single quotes.
252
   */
253
  NSArray* components = [string componentsSeparatedByString:@"'"];
254
255
  return [components componentsJoinedByString:@"'\"'\"'"];
256
}
257
248
- (NSString *)commandLineForScript: (NSString *)script
258
- (NSString *)commandLineForScript: (NSString *)script
249
{
259
{
250
    NSString *cur_interp = NULL;
260
    NSString *cur_interp = NULL;
261
    NSString* script_dir = NULL;
251
    char hashbangbuf[1024];
262
    char hashbangbuf[1024];
252
    FILE *fp;
263
    FILE *fp;
253
    char *p;
264
    char *p;
265
266
    script_dir = [script substringToIndex:
267
      [script length]-[[script lastPathComponent] length]];
254
    
268
    
255
    if (honourhashbang &&
269
    if (honourhashbang &&
256
       (fp=fopen([script cString], "r")) &&
270
       (fp=fopen([script cString], "r")) &&
257
       fgets(hashbangbuf, sizeof(hashbangbuf), fp) &&
271
       fgets(hashbangbuf, sizeof(hashbangbuf), fp) &&
258
       strncmp(hashbangbuf, "#!", 2) == 0 &&
272
       strncmp(hashbangbuf, "#!", 2) == 0 &&
...
...
264
    }
278
    }
265
    if (!cur_interp)
279
    if (!cur_interp)
266
        cur_interp = interpreter;
280
        cur_interp = interpreter;
267
        
281
        
268
    return [NSString stringWithFormat:
282
    return [NSString stringWithFormat:
269
        @"\"%@\"%s%s%s%s%s%s %@ \"%@\" %@ %s",
283
        @"cd '%@' && '%@'%s%s%s%s%s%s %@ '%@' %@ %s",
270
        cur_interp,
284
      [self _replaceSingleQuotes:script_dir],
285
        [self _replaceSingleQuotes:cur_interp],
271
        debug?" -d":"",
286
        debug?" -d":"",
272
        verbose?" -v":"",
287
        verbose?" -v":"",
273
        inspect?" -i":"",
288
        inspect?" -i":"",
274
        optimize?" -O":"",
289
        optimize?" -O":"",
275
        nosite?" -S":"",
290
        nosite?" -S":"",
276
        tabs?" -t":"",
291
        tabs?" -t":"",
277
        others,
292
        others,
278
        script,
293
        [self _replaceSingleQuotes:script],
279
        scriptargs,
294
        scriptargs,
280
        with_terminal? "&& echo Exit status: $? && exit 1" : " &"];
295
        with_terminal? "&& echo Exit status: $? && exit 1" : " &"];
281
}
296
}
282
297
283
- (NSArray *) interpreters { return interpreters;};
298
- (NSArray *) interpreters { return interpreters;};