Opened 2 years ago

Closed 2 years ago

Last modified 2 years 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 2 years ago.
Trunk

Download all attachments as: .zip

Change History (6)

Changed 2 years ago by troelsk

Trunk

comment:1 Changed 2 years 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 2 years 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 2 years 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 2 years 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 2 years ago by troelsk

Ok thanks!

Note: See TracTickets for help on using tickets.