I’ve thought that mate is virtually the same as ‘open -a TextMate.app’, but I guess I’m wrong in this.
As when I run the following command, when there’s no hello2.txt, I get this error.
open -a TextMate.app hello2.txt The file /Users/smcho/hello2.txt does not exist.
But, it’s OK to run mate.
mate hello.txt --> opens the text mate.
What’s the difference between the two?
I even tried
open -a TextMate.app --args hello2.txt
But this time, TextMate run with the file name ‘Untitled’, not ‘hello2.txt’.
And this code opens the ‘hello3.txt’ without any problem.
[NSTask launchedTaskWithLaunchPath:@"/Applications/TextMate.app/Contents/MacOS/TextMate" arguments:[NSArray arrayWithObjects:@"hello3.txt", nil]];
openwill open the given file with the default or a specific application.means “Open the file
hello2.txtusing the application TextMate.app”.If there is no
hello2.txt, there’s nothingopencould open, with or without TextMate.app, hence the error.means “open nothing specific in the application TextMate.app (i.e. only open TextMate.app) and pass ‘hello2.txt’ as additional argument”. This is a different kind of argument than the first example. TextMate.app can decide what to do with that additional argument. Apparently it chooses to ignore it.
mateis a utility optionally installed by TextMate.means “I’d like to edit a file called
hello.txtin TextMate”, which is exactly what TextMate will let you do. It’s a different utility with different behavior and different purpose, and it seems to better suite what you want it to do.