Author Topic: 'save as' parses for options!?  (Read 3552 times)

Nosh

  • Community Member
  • Posts: 38
  • Hero Points: 1
'save as' parses for options!?
« on: March 18, 2007, 07:28:15 pm »
SlickEdit 10 for windows: If I 'save as' a file to change the encoding, the file name seems to be parsed for command line options. e.g. If I save as a file named 'test - test.txt' a file 'test test.txt' is created. A space and the hyphen is missing. Or a file named 'test -.txt' gives the error box "Unable to save test -.txt to test Invalid option".
Bug or feature?

Regards, Norbert

hs2

  • Senior Community Member
  • Posts: 2740
  • Hero Points: 288
Re: 'save as' parses for options!?
« Reply #1 on: March 18, 2007, 09:28:08 pm »
save_as takes a 'cmdline' incl. -options as argument.
Use quotes if you're using '-' chars in filenames there i.e. enter "test - test.txt".

HS2

Nosh

  • Community Member
  • Posts: 38
  • Hero Points: 1
Re: 'save as' parses for options!?
« Reply #2 on: March 19, 2007, 11:21:35 am »
I use the 'save as' dialog box, not the save_as slick command. Even if I enclose the file name in double quotes at the file name field, I get the same error message.

Norbert

PS: single quotes work now, but do I have to check really if the name contains <SPACE><HYPHEN> and then use quotes? For me it's a bug that should be handled by the 'save as' dialog box subroutine.

PSPS: The created file name now also has the quotes.
« Last Edit: March 19, 2007, 11:44:38 am by Nosh »

hs2

  • Senior Community Member
  • Posts: 2740
  • Hero Points: 288
Re: 'save as' parses for options!?
« Reply #3 on: March 19, 2007, 11:40:24 am »
The command finally executed by the dialog (gui_save_sa in fact) is 'save_as'.
Strange enough - the quoting worked for me (SE >= v11.02). I afraid it's a v10 issue...
But maybe you should give a try to the commandline coammand save-as / sa as workaround.
sa test - test.txt (w/o quotes - it's done internally)

HS2

Nosh

  • Community Member
  • Posts: 38
  • Hero Points: 1
Re: 'save as' parses for options!?
« Reply #4 on: March 26, 2007, 11:32:05 am »
The error is in the file 'files.e' function 'save_as'.

Code: [Select]
   line=strip(line,'B','"');
   if (preserve_old_name || _process_info('b') || file_eq(p_buf_name,absolute(line)) || _isGrepBuffer(p_buf_name)) {
      // Preserve old name
      status=save(read_only:+save_options:+cfe_option:+line,sv_flags);
   } else {

The variable 'line' contains the file name _with_ double quotes, but the quotes are striped to compare with the current file name.
Then the file name without quotes is passed to the 'save' function. Why is the file name passed to 'save' at all, because this is the branch where the file name doesn't change?

Regards, Norbert