Thread overview
platformstl::path on MinGW on Windows - uses Unicode
Nov 05, 2010
Adi Shavit
Nov 05, 2010
Matt Wilson
Nov 08, 2010
Adi Shavit
Nov 08, 2010
Matt Wilson
Nov 22, 2010
Matt Wilson
November 05, 2010
Hi,

  I'm using platformstl::path on MinGW on Windows (via the Qt Creator IDE).
It redirects to using winstl::path. However, it seems to define path to use wide-char/Unicode encoding by default (for the file names for example).

How can I change this default?

As a workaround I changed to explicitly using winstl::path_a, but this is not portable to Unix/Linux.

Please advise,
Thanks,
Adi

November 05, 2010
IIRC it defines winstl::path as winstl::basic_path<TCHAR>, so it depends on the defin. of UNICODE.

Checking now ... yes, that's right.

  typedef basic_path<TCHAR, filesystem_traits<TCHAR> > path;

unixstl::path is defined as char, since the definition of UNICODE is not a done practice on UNIX. (Or if it is, that's a new one on me.)

I recognise that this is a little odd, but it was the best choice I could come up with. Have an open ear to other ideas ...


"Adi Shavit" <adishavit_thisDoesNotBelongHere_@gmail.com> wrote in message news:ib1o23$h5$1@digitalmars.com...
> Hi,
>
>  I'm using platformstl::path on MinGW on Windows (via the Qt Creator IDE).
> It redirects to using winstl::path. However, it seems to define path to
> use wide-char/Unicode encoding by default (for the file names for
> example).
>
> How can I change this default?
>
> As a workaround I changed to explicitly using winstl::path_a, but this is not portable to Unix/Linux.
>
> Please advise,
> Thanks,
> Adi
> 


November 08, 2010
So let me see if I get you correctly:

1. I want to use platformstl (and not winstl) for portability (to Linux).
2. I want to always work with chars
3. There seems to be no platformstl::path_a

I ended up doing this:

#ifdef UNICODE
#undef UNICODE
#include "3rdParty/stlsoft-1.9.101/include/platformstl/filesystem/path.hpp"
#define UNICODE
#endif

and use platformstl::path

Is this the right approach?

Suggestion: If platformstl::path_a was available it would have been simpler...

Thanks,
Adi

Matt Wilson Wrote:

> IIRC it defines winstl::path as winstl::basic_path<TCHAR>, so it depends on the defin. of UNICODE.
> 
> Checking now ... yes, that's right.
> 
>   typedef basic_path<TCHAR, filesystem_traits<TCHAR> > path;
> 
> unixstl::path is defined as char, since the definition of UNICODE is not a done practice on UNIX. (Or if it is, that's a new one on me.)
> 
> I recognise that this is a little odd, but it was the best choice I could come up with. Have an open ear to other ideas ...
> 
> 
> "Adi Shavit" <adishavit_thisDoesNotBelongHere_@gmail.com> wrote in message news:ib1o23$h5$1@digitalmars.com...
> > Hi,
> >
> >  I'm using platformstl::path on MinGW on Windows (via the Qt Creator IDE).
> > It redirects to using winstl::path. However, it seems to define path to
> > use wide-char/Unicode encoding by default (for the file names for
> > example).
> >
> > How can I change this default?
> >
> > As a workaround I changed to explicitly using winstl::path_a, but this is not portable to Unix/Linux.
> >
> > Please advise,
> > Thanks,
> > Adi
> > 
> 
> 

November 08, 2010
Adi Shavit Wrote:

> So let me see if I get you correctly:
> 
> 1. I want to use platformstl (and not winstl) for portability (to Linux).
> 2. I want to always work with chars
> 3. There seems to be no platformstl::path_a
> 
> I ended up doing this:
> 
> #ifdef UNICODE
> #undef UNICODE
> #include "3rdParty/stlsoft-1.9.101/include/platformstl/filesystem/path.hpp"
> #define UNICODE
> #endif
> 
> and use platformstl::path
> 
> Is this the right approach?
> 
> Suggestion: If platformstl::path_a was available it would have been simpler...

Yuck! That's not good.

Point taken.
November 22, 2010
This is now done as you suggest.

Matt

"Adi Shavit" <adishavit_thisDoesNotBelongHere_@gmail.com> wrote in message news:ib9n4e$2m6l$1@digitalmars.com...
> So let me see if I get you correctly:
>
> 1. I want to use platformstl (and not winstl) for portability (to Linux).
> 2. I want to always work with chars
> 3. There seems to be no platformstl::path_a
>
> I ended up doing this:
>
> #ifdef UNICODE
> #undef UNICODE
> #include
> "3rdParty/stlsoft-1.9.101/include/platformstl/filesystem/path.hpp"
> #define UNICODE
> #endif
>
> and use platformstl::path
>
> Is this the right approach?
>
> Suggestion: If platformstl::path_a was available it would have been simpler...
>
> Thanks,
> Adi
>
> Matt Wilson Wrote:
>
>> IIRC it defines winstl::path as winstl::basic_path<TCHAR>, so it depends
>> on
>> the defin. of UNICODE.
>>
>> Checking now ... yes, that's right.
>>
>>   typedef basic_path<TCHAR, filesystem_traits<TCHAR> > path;
>>
>> unixstl::path is defined as char, since the definition of UNICODE is not
>> a
>> done practice on UNIX. (Or if it is, that's a new one on me.)
>>
>> I recognise that this is a little odd, but it was the best choice I could come up with. Have an open ear to other ideas ...
>>
>>
>> "Adi Shavit" <adishavit_thisDoesNotBelongHere_@gmail.com> wrote in
>> message
>> news:ib1o23$h5$1@digitalmars.com...
>> > Hi,
>> >
>> >  I'm using platformstl::path on MinGW on Windows (via the Qt Creator
>> > IDE).
>> > It redirects to using winstl::path. However, it seems to define path to
>> > use wide-char/Unicode encoding by default (for the file names for
>> > example).
>> >
>> > How can I change this default?
>> >
>> > As a workaround I changed to explicitly using winstl::path_a, but this
>> > is
>> > not portable to Unix/Linux.
>> >
>> > Please advise,
>> > Thanks,
>> > Adi
>> >
>>
>>
>