This commit is contained in:
sumibi-yakitori 2025-09-16 14:53:36 +08:00 committed by GitHub
commit d7f67f70ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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]))