Merge pull request #18 from dannluciano/master

Added open support in OS X.
This commit is contained in:
vysheng 2013-11-29 13:42:06 -08:00
commit 273320fd08

View File

@ -48,6 +48,12 @@
#define sha1 SHA1 #define sha1 SHA1
#ifdef __APPLE__
#define OPEN_BIN "open %s"
#else
#define OPEN_BIN "xdg-open %s"
#endif
char *get_downloads_directory (void); char *get_downloads_directory (void);
int verbosity; int verbosity;
extern int offline_mode; extern int offline_mode;
@ -1777,7 +1783,7 @@ void end_load (struct download *D) {
logprintf ("Done: %s\n", D->name); logprintf ("Done: %s\n", D->name);
} else if (D->next == 2) { } else if (D->next == 2) {
static char buf[1000]; static char buf[1000];
sprintf (buf, "xdg-open %s", D->name); sprintf (buf, OPEN_BIN, D->name);
int x = system (buf); int x = system (buf);
if (x < 0) { if (x < 0) {
logprintf ("Can not open image viewer: %m\n"); logprintf ("Can not open image viewer: %m\n");