summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/app.c b/src/app.c
index 2614c454..9a7ced62 100644
--- a/src/app.c
+++ b/src/app.c
@@ -476,6 +476,29 @@ static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance,
476 476
477static void init_App_(iApp *d, int argc, char **argv) { 477static void init_App_(iApp *d, int argc, char **argv) {
478 init_CommandLine(&d->args, argc, argv); 478 init_CommandLine(&d->args, argc, argv);
479 /* Where was the app started from? We ask SDL first because the command line alone is
480 not a reliable source of this information, particularly when it comes to different
481 operating systems. */ {
482 char *exec = SDL_GetBasePath();
483 if (exec) {
484 d->execPath = newCStr_String(concatPath_CStr(
485 exec, cstr_Rangecc(baseName_Path(executablePath_CommandLine(&d->args)))));
486 }
487 else {
488 d->execPath = copy_String(executablePath_CommandLine(&d->args));
489 }
490 SDL_free(exec);
491 }
492#if defined (iHaveLoadEmbed)
493 /* Load the resources from a file. */ {
494 if (!load_Embed(concatPath_CStr(cstr_String(execPath_App()), EMB_BIN))) {
495 if (!load_Embed(concatPath_CStr(cstr_String(execPath_App()), EMB_BIN2))) {
496 fprintf(stderr, "failed to load resources: %s\n", strerror(errno));
497 exit(-1);
498 }
499 }
500 }
501#endif
479 /* Configure the valid command line options. */ { 502 /* Configure the valid command line options. */ {
480 defineValues_CommandLine(&d->args, "close-tab", 0); 503 defineValues_CommandLine(&d->args, "close-tab", 0);
481 defineValues_CommandLine(&d->args, "echo;E", 0); 504 defineValues_CommandLine(&d->args, "echo;E", 0);
@@ -489,7 +512,7 @@ static void init_App_(iApp *d, int argc, char **argv) {
489 iStringList *openCmds = new_StringList(); 512 iStringList *openCmds = new_StringList();
490 /* Handle command line options. */ { 513 /* Handle command line options. */ {
491 if (contains_CommandLine(&d->args, "help")) { 514 if (contains_CommandLine(&d->args, "help")) {
492 printf("Usage: lagrange [options] [URLs] [paths]\n"); 515 puts(cstr_Block(&blobArghelp_Embedded));
493 terminate_App_(0); 516 terminate_App_(0);
494 } 517 }
495 if (contains_CommandLine(&d->args, "version;V")) { 518 if (contains_CommandLine(&d->args, "version;V")) {
@@ -528,22 +551,9 @@ static void init_App_(iApp *d, int argc, char **argv) {
528 } 551 }
529 } 552 }
530 } 553 }
531 /* Where was the app started from? We ask SDL first because the command line alone is
532 not a reliable source of this information, particularly when it comes to different
533 operating systems. */ {
534 char *exec = SDL_GetBasePath();
535 if (exec) {
536 d->execPath = newCStr_String(concatPath_CStr(
537 exec, cstr_Rangecc(baseName_Path(executablePath_CommandLine(&d->args)))));
538 }
539 else {
540 d->execPath = copy_String(executablePath_CommandLine(&d->args));
541 }
542 SDL_free(exec);
543 }
544 init_Ipc(dataDir_App_());
545 /* Only one instance is allowed to run at a time; the runtime files (bookmarks, etc.) 554 /* Only one instance is allowed to run at a time; the runtime files (bookmarks, etc.)
546 are not shareable. */ { 555 are not shareable. */ {
556 init_Ipc(dataDir_App_());
547 const iProcessId instance = check_Ipc(); 557 const iProcessId instance = check_Ipc();
548 if (instance) { 558 if (instance) {
549 communicateWithRunningInstance_App_(d, instance, openCmds); 559 communicateWithRunningInstance_App_(d, instance, openCmds);
@@ -621,16 +631,6 @@ static void init_App_(iApp *d, int argc, char **argv) {
621 0x1f306); 631 0x1f306);
622 fetchRemote_Bookmarks(d->bookmarks); 632 fetchRemote_Bookmarks(d->bookmarks);
623 } 633 }
624#if defined (iHaveLoadEmbed)
625 /* Load the resources from a file. */ {
626 if (!load_Embed(concatPath_CStr(cstr_String(execPath_App()), EMB_BIN))) {
627 if (!load_Embed(concatPath_CStr(cstr_String(execPath_App()), EMB_BIN2))) {
628 fprintf(stderr, "failed to load resources: %s\n", strerror(errno));
629 exit(-1);
630 }
631 }
632 }
633#endif
634 d->window = new_Window(d->initialWindowRect); 634 d->window = new_Window(d->initialWindowRect);
635 init_Feeds(dataDir_App_()); 635 init_Feeds(dataDir_App_());
636 /* Widget state init. */ 636 /* Widget state init. */