Ticket URL: <
http://trac.wxwidgets.org/ticket/14542#comment:26>
#14542: Make wxFileName and wxDir symlink-friendly
-----------------------------------------------+----------------------------
Reporter: dghart | Owner:
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: fixed | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14649, 14649, 14649, 14649 |
-----------------------------------------------+----------------------------
Changes (by dghart):
* blocking: 1993, 14544, 14544, 14544, 14544, 14544, 14544, 14544,
14544, 14544, 14649, 14649, 14649, 14649 =>
1993, 14649, 14649, 14649, 14649
Comment:
Replying to [comment:25 vadz]:
> Believe it or not, but I did consider it. However I'd also like to add a
test for symlink existence as this can be useful and I'd really prefer to
do it by adding flags to `Exists()` rather than by adding yet another
`LinkExists()` so flags would be better here.
>
> And for now the best I can see is to allow
> {{{
> #!cpp
> if ( wxFileName::Exists(wxFILE_EXISTS_FILE | wxFILE_EXISTS_NO_FOLLOW) )
> ...
> }}}
Ah, I understand now.
>OTOH it's not without its problems neither as this would mean that the
non-static `Exists()` shouldn't take the same flags because
`wxFILE_EXISTS_NO_FOLLOW` could conflict with `m_dontFollowLinks`.
Using wxFILE_EXISTS_NO_FOLLOW in non-static Exists() sounds to me like a
feature, and certainly not a problem. fn(wxFILE_EXISTS_DIR |
wxFILE_EXISTS_NO_FOLLOW) would test if fn holds a real dir, not a symlink,
without changing fn's default behaviour.
> So finally perhaps it's indeed better to do nothing for now and maybe
add `LinkExists()` etc (`FIFOExists()`? `SocketExists()?) later if anybody
asks for it.
I'm happy to implement this, or similar, if you wish. I wonder though if
it's worth adding extra functions (`FIFOExists()` etc) which will seldom
be used, to the already function-heavy wxFileName.
wxFilename::Exists(wxFILE_EXISTS_FLAGS flag = wxFILE_EXISTS_ANY) is less
readable, but allows testing for multiple types.
--
Ticket URL: <
http://trac.wxwidgets.org/ticket/14542#comment:26>