What is the difference between “./” and “open” in a terminal and how can I run a Unix executable from Xcode?

I am new to all this and I would like to excuse me for my ignorance.

I have a unix executable. I start the terminal with the command: open the argument --args opennamename, and it answers that it cannot find the resource file (which is the argument that I'v passed.)

I tried to write an argument. / programname and it works.

Firstly, I would like to know the difference between the two methods and why the first does not work, and the second works.

Now the problem is that I cannot do this in Xcode. When the executable is running, it says that it cannot find the resource file. I passed the argument in the executable using cmd + I to the executable and added the resource file as an argument.

Thanks for your potential answer.

+3
source share
2 answers

openis the exact equivalent of double-clicking on things in Finder. Therefore, if you use it in a UNIX executable, then the executable will be launched, but the current working directory will not be where the executable is located, and will not necessarily be useful. However, you can also use it to open a .doc file or any other type of file, to open a directory in Finder, open a URL in finder, etc.

. /name - UNIX UNIX. , , . , , ( , , .. /name ).

, , , , , ? , , , -, POSIX, .

C -, C (, ++, Objective-C ..), NSGetExecutablePath ( Google , ., , ) , . Objective-C, NSString .

+2

"open" - , , Finder, .

./- , chmod.

, Mac OS X , "open/Applications/MyApp.app/". , ./MyApp.app/( /Applications ).

" " , .

+1

Source: https://habr.com/ru/post/1785490/


All Articles