wxWidgets / wxWidgets

Cross-Platform C++ GUI Library
https://www.wxwidgets.org/
5.78k stars 1.7k forks source link

wxDirDialog doesn't display symbolic links to directories correctly. #21358

Open wxtrac opened 19 years ago

wxtrac commented 19 years ago

Issue migrated from trac ticket # 1993

component: GUI-generic | priority: low | keywords: wxDirDialog symlinks

2004-10-22 20:35:54: @dghart created the issue


There is an internal function called wxStat, which for *nix setups is a #define for stat. As a result, functions that rely on it cope badly with symlinks, since wxStat reports on the target file rather than on the symlink itself.

wxDirExists() and wxPathExists() treat a 'symlink pointing to a dir' as though it itself is a dir. wxFileExists() returns false if a symlink exists but is broken. wxCopyFile() ditto (amoungst other problems) wxFileModificationTime() will report the mod-time of the target, not the link.

wxFileName uses wxDirExists() & wxFileExists(), and so behaves similarly.

All this won't matter to most programs, but wxFileDialog and wxGenericDirCtrl display 'symlinks pointing to dirs' as dirs.

Possible fixes: a) Redefine wxStat as lstat. This will solve these problems without side-effects. However the name becomes misleading; and it is just possible that the change might break somebody's code that uses wxStat. b) Invent a new wxLstat, and change the functions to use this. c) Make larger changes, especially to wxCopyFile, so that symlinks are properly dealt with.

I should be able to create patches for a) or b), and I have code that may be helpful for c)

David Hart