Bug 425136

Summary: Kate on Windows: Save dialogs use "C:\Program Files\Kate\bin" as initial folder
Product: [Applications] kate Reporter: fliegenblues
Component: applicationAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: christoph, jpmbatrina01
Priority: NOR    
Version First Reported In: 20.04.2   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description fliegenblues 2020-08-08 11:33:45 UTC
SUMMARY

When I want to save a file that has not been saved yet or select one of the different "Save as" menu items, the file browser dialog that opens, initially shows the folder in which Kate is installed, e.g. "C:\Program Files\Kate\bin". It would be more convenient, if the file browser would initially show the user folder of the currently logged in user, e.g. "C:\Users\Matthias".

This is as I saw a duplicate to bug 163443. Nevertheless, I would prefer that on Windows, Windows-like behavior is used. Is there the possibility to conditionally compile Kate for Windows and for Linux, so that the Windows version uses the user folder and the Linux version uses the working directory as default?

STEPS TO REPRODUCE

1. Save a not yet saved document OR Select a "Save as" menu item
2. The file browser dialog opens with the folder "C:\Program Files\Kate\bin" as default.

OBSERVED RESULT

The file browser dialog opens with the folder "C:\Program Files\Kate\bin" as default.

EXPECTED RESULT

The file browser dialog opens with the folder "C:\Users\<UserName>" as default.
Comment 1 Christoph Cullmann 2020-08-11 19:06:01 UTC
You are right that this is suboptimal.

Unfortunately, that is not just one place and one would actually like to check if one was launched via a terminal windows and only use the home dir in the cases one was not launched there.
Comment 2 fliegenblues 2020-09-04 12:21:15 UTC
What speaks against always using the user's home folder as default folder for the save dialogs? It is in my opinion what most users would expect, especially on Windows. Moreover, in Windows, kwrite/kate will almost never be started from a terminal window, only by using the start menu or by double clicking a file in the explorer. 
It's really annoying that when saving a document, one has always to navigate to the documents folder in the user's home folder first before you can save the file.
Moreover, I don't think, that there is a way in Linux or Windows for querying whether one has been started from a terminal window, or by other means.
Comment 3 Jan Paul Batrina 2020-11-21 07:45:56 UTC
https://invent.kde.org/packaging/craft-blueprints-kde/-/merge_requests/43 Partially addresses this, but only when Kate is launched via the shortcut (e.g. Start Menu), which I think is the main method in windows.

Previously, the working directory of the shortcut was set to the installation folder, and kate sets the file picker's initial location to the working directory.
Comment 4 fliegenblues 2020-11-21 13:32:27 UTC
Does this also work if I pin kwrite to the taskbar and open it from there?
Comment 5 Jan Paul Batrina 2020-11-22 03:26:05 UTC
(In reply to fliegenblues from comment #4)
> Does this also work if I pin kwrite to the taskbar and open it from there?

I just tested this right now (for Kate), and it seems to work for Right Click > Pin to taskbar as well as on "Pin to Start" and "Pin to taskbar" on the Start menu.

I don't know how Windows handles the "Pin to" stuff, but I think what happens is For "Pin to taskbar", a copy of the shortcut (if it exists) is placed on the taskbar, and changes to the original shortcut won't be reflected. For "Pin to Start", changes to the original shortcut are propagated.

So I think it will work, as long as you set the working directory of the original shortcut first BEFORE pinning to the taskbar
Comment 6 Jan Paul Batrina 2020-12-31 12:42:52 UTC
Fixed with https://invent.kde.org/packaging/craft/-/merge_requests/14