Skip to content

Commit

Permalink
Merge pull request #90 from florianbegusch/open_multiple_files_from_c…
Browse files Browse the repository at this point in the history
…ommand_line_args_again

Open multiple files from command line args again
  • Loading branch information
alexandervdm committed Sep 13, 2018
2 parents cdf073b + f61fdc8 commit dd41c31
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/main.c
Expand Up @@ -155,15 +155,17 @@ int main (int argc, char *argv[]) {
/* Install acceleration group to mainwindow */
gtk_window_add_accel_group (gui->mainwindow, snippets->accel_group);

if (argc != 2)
tabmanager_create_tab (A_DEFAULT, NULL, NULL);
else {
if (!g_file_test(argv[1], G_FILE_TEST_EXISTS)) {
slog(L_ERROR, "Failed to open file '%s': No such file or "
"directory\n", argv[1]);
exit(1);
}
tabmanager_create_tab (A_LOAD, argv[1], NULL);
if (argc > 1) {
int i;
for (i = 1; i < argc; i++) {
if (!g_file_test(argv[i], G_FILE_TEST_EXISTS)) {
slog(L_ERROR, "Failed to open file '%s': "
"No such file or directory\n", argv[i]);
exit(1);
}

tabmanager_create_tab (A_LOAD, argv[i], NULL);
}
}

if (config_get_value ("autosaving")) iofunctions_start_autosave ();
Expand Down

0 comments on commit dd41c31

Please sign in to comment.