Use win32 functions for accessing filename
[pspp] / src / ui / gui / psppire.c
index 9ed7d15becb3e4757006d6bbfcc95238eb2c605e..1b0031b23f1303cf1ae65079e1ce84c97e40cc12 100644 (file)
@@ -126,12 +126,23 @@ initialize (const struct init_source *is)
       break;
     case 14:
       {
-      if (is->file)
+      if (is->filename_arg != -1)
        {
+#ifndef G_OS_WIN32
+         const char *file = (*is->argv)[is->filename_arg];
          const gchar *local_encoding = NULL;
          g_get_charset (&local_encoding);
-
-         struct file_handle *fh = fh_create_file (NULL, is->file, local_encoding, fh_default_properties ());
+#else
+         char **as = g_win32_get_command_line ();
+         const char *file = as[is->filename_arg];
+         const gchar *local_encoding = "UTF-8";
+#endif   
+
+         struct file_handle *fh = fh_create_file (NULL,
+                                                  file,
+                                                  local_encoding,
+                                                  fh_default_properties ());
+         
          const char *filename = fh_get_file_name (fh);
 
          int retval = any_reader_detect (fh, NULL);