Compare commits

...

2 Commits

Author SHA1 Message Date
sumibi-yakitori 6d38f1308d
Merge 71dfcbb878 into c904c41b39 2025-07-18 18:52:41 -03:00
sumibi-yakitori 71dfcbb878 Change the initial path in the file dialog to be the currently opened file 2022-08-15 04:25:42 +09:00
1 changed files with 8 additions and 0 deletions

View File

@ -80,6 +80,14 @@ void OpenFileCommand::onExecute(Context* context)
if (context->isUIAvailable() && m_filename.empty()) {
base::paths exts = get_readable_extensions();
auto doc = context->activeDocument();
if (m_folder.empty() && doc) {
auto filename = doc->filename();
if (!filename.empty()) {
m_folder = base::get_file_path(filename);
}
}
// Add backslash as show_file_selector() expected a filename as
// initial path (and the file part is removed from the path).
if (!m_folder.empty() && !base::is_path_separator(m_folder[m_folder.size() - 1]))