File filters should handle double extensions
Original Reporter info from Mantis: crlab @neurolabusc1
-
Reporter name: Chris Rorden
Original Reporter info from Mantis: crlab @neurolabusc1
- Reporter name: Chris Rorden
Description:
To maintain Delphi compatibility, the LCL should respect double extensions when provided as a filter by the user. Common examples of these files are tar files (.TAR.GZ / .TAR.BZ / .TAR.XZ), and ones specific to my field (neuroimaging) includes (.NII.GZ). If a user provides a filter of ".tar.gz' they are explicitly requesting something different from ".gz".
The additional information provides a patch to replicate Delphi behavior. Typical, single extensions are unchanged, but double extensions are now handled correctly.
Steps to reproduce:
procedure TForm1.Button1Click(Sender: TObject);
begin
SaveDialog1.Filter := 'gz|*.gz|nii.gz|*.nii.gz|nii|*.nii|roi|*.roi';
SaveDialog1.Filename := 'SaveName';
SaveDialog1.FilterIndex:= 2;
SaveDialog1.DefaultExt := '.roi';
if not SaveDialog1.Execute then exit;
Caption := SaveDialog1.Filename;
end;
Additional information:
Chriss-MacBook-Pro:include rorden$ diff filedialog.inc filedialogOld.inc
306,310c306
< //Filter := ExtractFileExt(Filter);
< if (Pos('.',Filter) > 1) then //e.g. "*.nii.gz"
< Delete(Filter, 1, Pos('.',Filter)-1)
< else
< Filter := ExtractFileExt(Filter);
---
Filter := ExtractFileExt(Filter);
Mantis conversion info:
- Mantis ID: 32069
- OS: Darwin
- OS Build: 10.11
- Build: 55404
- Platform: MacBook Retina
- Version: 1.9 (SVN)
- Fixed in revision: 56997 (#4a7772da)
- Monitored by: » @neurolabusc1 (Chris Rorden)