Changeset 3050

Show
Ignore:
Timestamp:
03/09/03 05:55:38 (6 years ago)
Author:
himi
Message:

(Fmw32_file_dialog): Almost totally rewrite
how to handle filename, i.e., manipulate filename with Emacs Lisp
functions, then finally encode it to a system dependent text.
And encode "prompt" as well.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • work/cvs2svn/src/mw32fns.c

    r3029 r3050  
    89328932  int count = specpdl_ptr - specpdl; 
    89338933  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 
    8934   char filename[MAX_PATH + 1]
    8935   char init_dir[MAX_PATH + 1]; 
     8934  LPTSTR init_dir
     8935  TCHAR filename[MAX_PATH + 1]; 
    89368936  int use_dialog_p = 1; 
    89378937 
     
    89438943     directory and using "*" as pattern.  */ 
    89448944  dir = Fexpand_file_name (dir, Qnil); 
    8945   strncpy (init_dir, XSTRING (dir)->data, MAX_PATH); 
    8946   init_dir[MAX_PATH] = '\0'; 
    8947   unixtodos_filename (init_dir); 
     8945  init_dir = mw32_encode_lispy_string (Vw32_system_coding_system, 
     8946                                       Funix_to_dos_filename (dir), NULL); 
    89488947 
    89498948  if (STRINGP (default_filename)) 
    89508949    { 
    8951       char *file_name_only; 
    8952       char *full_path_name = XSTRING (ENCODE_FILE (default_filename))->data; 
    8953  
    8954       unixtodos_filename (full_path_name); 
    8955  
    8956       file_name_only = strrchr (full_path_name, '\\'); 
    8957       if (!file_name_only) 
    8958         file_name_only = full_path_name; 
     8950      file = Ffile_name_nondirectory (Funix_to_dos_filename (default_filename)); 
     8951      if (LISPY_STRING_BYTES(file) > 0) 
     8952        { 
     8953          int size; 
     8954          LPTSTR filename_tmp; 
     8955 
     8956          filename_tmp = mw32_encode_lispy_string (Vw32_system_coding_system, file, &size); 
     8957          memcpy (filename, filename_tmp, size); 
     8958          filename[size / sizeof(filename[0])] = '\0'; 
     8959        } 
    89598960      else 
    8960         { 
    8961           file_name_only++; 
    8962  
    8963           /* If default_file_name is a directory, don't use the open 
    8964              file dialog, as it does not support selecting 
    8965              directories. */ 
    8966           if (!(*file_name_only)) 
    8967             use_dialog_p = 0; 
    8968         } 
    8969  
    8970       strncpy (filename, file_name_only, MAX_PATH); 
    8971       filename[MAX_PATH] = '\0'; 
     8961        { 
     8962          /* If default_file_name is a directory, don't use the open 
     8963             file dialog, as it does not support selecting 
     8964             directories. */ 
     8965          use_dialog_p = 0; 
     8966        } 
    89728967    } 
    89738968  else 
     
    89868981      file_details.hwndOwner = FRAME_MW32_WINDOW (f); 
    89878982      file_details.lpstrFile = filename; 
    8988       file_details.nMaxFile = sizeof (filename)
     8983      file_details.nMaxFile = sizeof (filename) / sizeof (filename[0])
    89898984      file_details.lpstrInitialDir = init_dir; 
    8990       file_details.lpstrTitle = XSTRING (prompt)->data; 
     8985      file_details.lpstrTitle = mw32_encode_lispy_string (Vw32_system_coding_system, 
     8986                                                          prompt, NULL); 
    89918987      file_details.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR; 
    89928988 
     
    89968992      if (GetOpenFileName (&file_details)) 
    89978993        { 
    8998           dostounix_filename (filename); 
    8999           file = DECODE_FILE (build_string (filename)); 
     8994          file = mw32_decode_lispy_string (Vw32_system_coding_system, 
     8995                                           filename, 0); 
     8996          file = Fdos_to_unix_filename (file); 
    90008997        } 
    90018998      else 
    9002         file = Qnil; 
     8999       file = Qnil; 
    90039000 
    90049001      UNBLOCK_INPUT;