Opened 18 months ago

Closed 18 months ago

Last modified 18 months ago

#14771 closed defect (fixed)

incompatible change in r72707

Reported by: troelsk Owned by:
Priority: normal Milestone:
Component: base Version: stable-latest
Keywords: wxFileName Cc:
Blocked By: Blocking:
Patch: yes

Description

wxFileName::DirExists() used to drop the file name and do the check on the dir part only.
Patch: restore old behaviour

Attachments (1)

direxists.patch download (388 bytes) - added by troelsk 18 months ago.
Trunk

Download all attachments as: .zip

Change History (6)

Changed 18 months ago by troelsk

Trunk

comment:1 Changed 18 months ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(In [72718]) Revert accidental incompatible change to wxFileName::DirExists().

The non-static version tests for the existence of the directory part of the
object only as is explicitly mentioned in the documentation, so do the test on
GetPath() and not GetFullPath() as we did since r72707.

Also add a unit test for this behaviour.

Closes #14771.

comment:2 Changed 18 months ago by troelsk

There's a ticking bomb there, referencing a temp string object

const wxString& tempdir = wxFileName::GetTempDir();

[
http://svn.wxwidgets.org/viewvc/wx/wxWidgets/trunk/tests/filename/filenametest.cpp?r1=72717&r2=72718&pathrev=72718
]

comment:3 follow-up: Changed 18 months ago by csomor

the const reference to the temp remains valid until it goes out of scope IIRC

comment:4 in reply to: ↑ 3 Changed 18 months ago by vadz

Replying to csomor:

the const reference to the temp remains valid until it goes out of scope IIRC

Yes, exactly.

comment:5 Changed 18 months ago by troelsk

Ok thanks!

Note: See TracTickets for help on using tickets.