- data_window = psppire_default_data_window ();
- if (data_file != NULL)
- load_data_file (data_window, data_file);
+ 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))
+ open_data_window (NULL, filename, NULL);
+ else
+ {
+ create_data_window ();
+ open_syntax_window (filename, NULL);
+ }
+
+ g_free (filename);
+ }
+ else
+ create_data_window ();