Add open multiple files from command line arguments
@@ -155,15 +155,16 @@ 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)) {
+ if (argc > 1) {
+ for ( int 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[1]);
+ "directory\n", argv[i]);
exit(1);
}
- tabmanager_create_tab (A_LOAD, argv[1], NULL);
+
+ tabmanager_create_tab (A_LOAD, argv[i], NULL);
+ }
}
if (config_get_value ("autosaving")) iofunctions_start_autosave ();
