lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Using picker controls for paths


From: Vadim Zeitlin
Subject: Re: [lmi] Using picker controls for paths
Date: Thu, 9 Jun 2016 15:46:54 +0200

On Thu, 9 Jun 2016 12:47:57 +0000 Greg Chicares <address@hidden> wrote:

GC> On 2016-06-07 22:18, Greg Chicares wrote:
GC> > On 2016-06-07 20:35, Vadim Zeitlin wrote:
GC> >> On Tue, 7 Jun 2016 20:18:13 +0000 Greg Chicares <address@hidden> wrote:
GC> [...]
GC> >> GC> Curiously, if I exit and reload lmi, I see only forward slashes in
GC> >> GC> both GUI fields, though the xml file contains backslashes.
GC> >> 
GC> >>  This is a side effect of using fs::system_complete() in
GC> >> configurable_settings ctor. FWIW I wouldn't be surprised if newer version
GC> >> of Boost.Filesystem didn't behave in this way, it looks wrong to me to
GC> >> change the path separators, especially for an already absolute path.
GC> > 
GC> > Agreed.
GC> 
GC> Wait--I agreed too quickly. I think instead that it's a side effect of
GC> using string(), because the boost-1.33.1 documentation says:
GC> 
GC> |   path my_path( "foo/bar/data.txt" );
GC> | On Windows, the output would be:
GC> |   string------------------: foo/bar/data.txt
GC> |   native_directory_string-: foo\bar\data.txt
GC> |   native_file_string------: foo\bar\data.txt

 Just FYI this has completely changed in Boost.Filesystem v3 and C++17
filesystem library: string() now returns the path in the native format and
a separate generic_string() must be used to return it in the "generic"
(i.e. Unix/POSIX-ish) format, see

        http://en.cppreference.com/w/cpp/experimental/fs/path

GC> The difference between complete() and system_complete() has to do with
GC> multiple filesystem roots, not path separators.

 Yes, this is correct, but system_complete() still transforms backslashes
into slashes. string() is just a trivial accessor returning m_path in this
Boost.Filesystem version.

GC> And this seems to offer a way to achieve the behavior I personally
GC> prefer: always use forward slashes everywhere.

 I still don't think it's the behaviour appropriate for the end users under
MSW platform...

GC> All I have to do is call
GC> system_complete() and string() in these functions:
GC>   Transfer(transfer_direction td, std::string& data, wxDirPickerCtrl& 
control)
GC>   Transfer(transfer_direction td, std::string& data, wxFilePickerCtrl& 
control)

 I don't think this will be enough, you'll have to also deal with the path
being updated by the "..." button.

GC> Have you already started working on an alternative that would use
GC> forward slashes in the xml, and backward in the GUI?

 No, I haven't yet.

GC> If you have, then I wouldn't mind seeing your implementation. But if
GC> you haven't, then please wait to see what I can come up with.

 OK, I won't do anything for now, but please let me know if I should return
to the original plan should you run into any problems with this approach
(or decide to avoid confusing poor MSW users with forward slashes).

 Thanks in advance,
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]