- if (data_file != NULL)
- load_data_file (data_window, data_file);
- execute_const_syntax_string (data_window, "");
+
+ if (data_file)
+ {
+ gchar *filename = local_to_filename_encoding (data_file);
+
+ /* Check to see if the file is a .sav or a .por file. If not
+ assume that it is a syntax file */
+ if ( any_reader_may_open (filename))
+ psppire_window_load (PSPPIRE_WINDOW (data_window), filename);
+ else
+ open_syntax_window (filename, NULL);
+
+ g_free (filename);
+ }