• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSTask and 10.9
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTask and 10.9


  • Subject: NSTask and 10.9
  • From: koko <email@hidden>
  • Date: Tue, 26 Nov 2013 08:47:01 -0700

I need to remove hidden files from removable media and have been doing so successfully until 10.9.

I use NSTask as follows:

NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath:rootScriptPath];
[task setArguments:[NSArray arrayWithObjects:rootpath, nil]];
[task waitUntilExit];
[task launch];
[task release];


where rootScriptPath is from:

NSString *rootScriptPath = [[NSBundle mainBundle] pathForResource:@"DeleteHiddenRoot" ofType:nil];

and DeleteHiddenRoot is:

#!/bin/sh
rm -dfR "$1".f*
rm -dfR "$1"._*
rm -dfR "$1".DS*
rm -dfR "$1".S*
chmod ugo+rw "$1".Trashes
rm -dfR "$1".T*


finally, rootpath is from:

 	NSArray *pathComponents = [[NSString stringWithCString:(const char*)dir encoding:NSASCIIStringEncoding] pathComponents];
	NSString *mediapath = [pathComponents objectAtIndex:0];
	mediapath = [mediapath stringByAppendingPathComponent:[pathComponents objectAtIndex:1]];
	mediapath = [mediapath stringByAppendingPathComponent:[pathComponents objectAtIndex:2]];
    NSString *rootpath = [mediapath stringByAppendingString:@"/"];


This works just fine up to and including 10.8.5 BUT throws an exception at [task launch] on 10.9

Google reveals nothing about this … at first I thought that sh was not available but in Terminal on 10.9 entering !#/bin/sh puts you into sh

any help is much appreciated … !

-koko


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: NSTask and 10.9
      • From: Ken Thomases <email@hidden>
    • Re: NSTask and 10.9
      • From: Pax <email@hidden>
    • Re: NSTask and 10.9
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: iOS screen physical size (or px density)
  • Next by Date: Re: NSTask and 10.9
  • Previous by thread: Re: Best way to put a fixed view in a UITableViewController scene?
  • Next by thread: Re: NSTask and 10.9
  • Index(es):
    • Date
    • Thread