Bug 159880 - FILEOPEN When I say "lowriter foo.txt" and foo.txt does not exist, it should open a new empty document that saves to that name instead of dying
Summary: FILEOPEN When I say "lowriter foo.txt" and foo.txt does not exist, it should ...
Status: RESOLVED DUPLICATE of bug 40227
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsUXEval
Depends on:
Blocks:
 
Reported: 2024-02-25 17:13 UTC by Martin Guy
Modified: 2024-10-05 11:29 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Guy 2024-02-25 17:13:33 UTC
When I say "lowriter foo.txt" and foo.txt does not exist, it pops up a box titled Error with one button saying "/home/martin/foo.txt does not exist. [OK]" and when you click it, and it exits 0, as it a one-button dialogue (a no no in any GUI) weren't enough of an insult.

Not [OK] :)

What I expected was that it should open a new empty document that saves to foo.txt when I Ctrl-S or quit.

   M
Comment 1 Buovjaga 2024-02-25 17:39:28 UTC
*** Bug 159881 has been marked as a duplicate of this bug. ***
Comment 2 Heiko Tietze 2024-02-26 10:50:09 UTC
But what if you want to open foo.txt but mistakenly type fu.txt? Some hints on how to achieve your goal in this thread https://ask.libreoffice.org/t/how-to-create-empty-libreoffice-file-in-a-current-directory-on-the-command-line/32789 and probably others too. 

If we need to create a file it should be per command line switch. But isn't the above enough?
Comment 3 Martin Guy 2024-02-26 11:00:38 UTC
> what if you want to open foo.txt but mistakenly type fu.txt?
Then it will open a blank document called fu.txt and the careless user will figure out they typed it wrong

> Some hints on how to achieve your goal in this thread
I've been using text editors and word processors from the command line for 40 years, and they have all created an empty file of the requested name, which is why I expected lowriter to do the same. If libreoffice wants to be bizarre and awkward, apparently with no reason, I guess it can continue to be so.

Yes, I do know how to create an empty text file. Not an empty ODT though, and telling me to keep an empty ODT document handy in case I want another one is bordeding on folly.
Comment 4 Heiko Tietze 2024-02-26 11:09:47 UTC
(In reply to Martin Guy from comment #3)
> text editors and word processors from the command line...
> they have all created an empty file of the requested name
Maybe, but there are probably opposite example too. Thinking of tar.

Mike, what do you think about a command line switch to create a document? I think it should not overwrite existing documents, at least when not forced to.
Comment 5 Mike Kaganski 2024-02-26 11:32:29 UTC
An option to create a new document, without actually writing to disk, but which would (try to) save to that name if saved from the GUI, looks ~reasonable.

Then, special handling would be needed for other tasks like converting, printing, etc.

IMO, not worth the effort, but up to an interested developer.
Comment 6 Martin Guy 2024-02-26 12:17:42 UTC
Thanks for taking the idea seriously.

An option to create a new file would be another "libreoffice does it differently from every other word processor" while I'm talking about the principle of least surprise for end users.
Comment 7 V Stuart Foote 2024-02-26 12:19:50 UTC

*** This bug has been marked as a duplicate of bug 40227 ***
Comment 8 Mike Kaganski 2024-02-26 12:24:06 UTC
Note that it is completely incorrect that "every other word processor" does that. One single word processor that is the most used in the world (MS Word) doesn't. Running something like

> "C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE" c:\nonexistentDoc.docx

gives an error dialog telling

> Sorry, we couldn't find your file. Was it moved, renamed, or deleted?
Comment 9 Martin Guy 2024-02-26 12:45:32 UTC
@Mike: :D I didn't know that - I didn't even know you *could* launch Word from the command line and I doubt the devs thought any user ever would.
Before LO, it must have been the only WP in the world to have that defectXXXXXXcharacteristic and I'm not sure LOWriter should imitate MSWord just to imitate MSWord.

I had a quick look at making a patch but couldn't see immediately where to act.
It seems like it would be a fairly simple change for someone who already knows the code base, but if it's difficult for some lowriter-internal reason, don't bother.
Comment 10 Heiko Tietze 2024-02-26 15:44:18 UTC
(In reply to Martin Guy from comment #9)
> It seems like it would be a fairly simple change...
Code pointer in bug 40227 comment 9.
Comment 11 Mike Kaganski 2024-03-11 04:06:42 UTC
Additional code pointer could be the MediaDescriptor service [1], which has SuggestedSaveAsDir and SuggestedSaveAsName members. So your command line option could set them, or even its URL - the latter would skip the dialogs in case of direct Save.

[1] https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1document_1_1MediaDescriptor.html
Comment 12 Martin Guy 2024-10-05 11:29:15 UTC
I just say "lowriter" then "Save As..."

Resolved. They only have to come here.