From 7446930ef39e29c725559123562014b353e922d8 Mon Sep 17 00:00:00 2001 From: Bart <9132501-flyingsheep@users.noreply.gitlab.com> Date: Thu, 14 Mar 2024 19:46:07 +0100 Subject: [PATCH] TFilenameEdit: don't force the TOpenDialog.InitialDir to current directory if InitialDir is empty string. Issue #40845. --- lcl/editbtn.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lcl/editbtn.pas b/lcl/editbtn.pas index 2ecee3058f..38833741ad 100644 --- a/lcl/editbtn.pas +++ b/lcl/editbtn.pas @@ -1451,7 +1451,10 @@ begin O.Options := DialogOptions; O.Filter := Filter; O.FilterIndex := FilterIndex; - O.InitialDir := CleanAndExpandDirectory(InitialDir); + if (InitialDir <> '') then //don't force currentdir here, let WS do it's normal "magic" to decide where to open + O.InitialDir := CleanAndExpandDirectory(InitialDir) + else + O.InitialDir := ''; end; // Set some common things. Result.Title := DialogTitle;