nikora
nikora

Reputation: 817

NSTask works in xcode run but not when i run it outside xcode

I have created this app that make use of the /usr/bin/say command in OS X.

This method takes the value from a textfield and uses "say" to save it. But when i run this outside xcode. I don't get the saved file.

- (IBAction)save:(id)sender
{
    NSString *path;
    path = @"/usr/bin/say";

    NSArray *args;
    args = [NSArray arrayWithObjects: @"-o", @"text.wav", @"--data-format=LEF32@8000", [textField stringValue], nil];

    [[NSTask launchedTaskWithLaunchPath:path arguments:args] waitUntilExit];

    NSLog(@"Saved");
}

Anyone know what i'm doing wrong?

Upvotes: 0

Views: 185

Answers (1)

matt
matt

Reputation: 534977

Perhaps it's being saved but you don't know where. The path text.wav is a partial path, so it's going to be saved in the "current directory". But what directory is the "current directory"? You probably don't know.

Upvotes: 1

Related Questions