I used this command in Terminal and it can mount the drive successful. Now i want to put this command in Cocoa app to mount the Drive in my Cocoa app but i dont know how to call this. Is there anyway to put this command into the script and call the script? If put the script, we need to input the parameter for it. Pls advise. Thanks much
sshfs -p 12001 abc@host.example.com:/host/root testSSHFS
UPDATE:
I tried the below code but i got error but when I tried on Terminal, it can mount the drive successfully.
remote host has disconnected
mount_osxfusefs: failed to mount /Volumes/TEST_DRIVE@/dev/osxfuse4: Socket is not connected
Here is the code i using:
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/opt/local/bin/sshfs"];
[task setArguments:@[@"-p 12000", @"600252@abc.com:/test", @"/Volumes/TEST_DRIVE",@"-oauto_cache,reconnect,defer_permissions,negative_vncache,noappledouble,volname=TEST_DRIVE"]];
NSPipe *inPipe = [NSPipe pipe];
[task setStandardInput:inPipe];
NSPipe *outPipe = [NSPipe pipe];
[task setStandardOutput:outPipe];
NSFileHandle *writer = [inPipe fileHandleForWriting];
NSFileHandle *reader = [outPipe fileHandleForReading];
[task launch];
//Wait for the password prompt on reader [1]
NSString* password = @"d6b0ab7f1c8ab8f514db9a6d85de160a";
NSData *passwordData = [password dataUsingEncoding:NSUTF8StringEncoding];
[writer writeData:passwordData];
[task waitUntilExit];
Pls advise. thanks