Mac Unrar with a command line

moivhod

macrumors newbie
Original poster
Apr 8, 2017
9
0
I’m creating an app and one of its functions must be unpacking of a rar archive. I found couple of command line tools like here: http://www.rarlab.com/download.htm and here: http://unarchiver.c3.cx/commandline, but they require preliminary installation to be launched with a command line.


So how can my app launch any other app (child process) to unpack a rar file? I code using FireMoneky with C++ Builder (under Windows) and so far I can’t find there any cross-platform function to extract rar, that’s why I came up with an idea of extracting for Mac through a command line. Maybe my whole idea is wrong and not doable because of Mac security reasons. Would appreciate any input here. Thanks!
 

Toutou

macrumors 6502a
Jan 6, 2015
673
957
Prague, Czech Republic
RAR is a proprietary format, so unless the extraction algorithm is baked right into your app (and you have the licensing stuff sorted out) you can't count on any support. Is this feature really necessary? There are alternatives.
 

moivhod

macrumors newbie
Original poster
Apr 8, 2017
9
0
Is this feature really necessary?
Yep) The app I'm coding is sort of downloader and extractor the same time. It must help clients who purchased some digital products to download and unpack them correctly. Because many people, believe me, do have problem to do it manually by themselves)

So far I succeeded with this free command line extractor http://unarchiver.c3.cx/commandline by just typing in the Terminal
Code:
./unar x archive.rar
Hopefully, I'll be able to incorporate it in my app
 
Last edited:

Toutou

macrumors 6502a
Jan 6, 2015
673
957
Prague, Czech Republic
Yeah, if you manage to bundle the unar binary with your app, it should be easy to launch it from your C++ code (if you've never done this: the system() function is your friend).

You could even take the source and use your desired functionality — with a bit of hacking around — directly in your own code, it says in License.txt that it's okay if you ask the author.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.