Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

runtime_error in older boost when locales are not set

$
0
0

I tried, but it still makes problems.

it fails when calling of::priv::setWorkingDirectoryToDefault(); so its better to first try to set the locale and then set the working directory.

#ifdef TARGET_LINUX
    if(std::locale().name() == "C" || std::locale().name().empty()){
        try{
            std::locale::global(std::locale("C.UTF-8"));
        }catch(...){
            if(ofToLower(std::locale("").name()).find("utf-8")==std::string::npos){
                ofLogWarning("ofInit") << "Couldn't set UTF-8 locale, string manipulation functions\n"
                        "won't work correctly for non ansi characters unless you specify a UTF-8 locale\n"
                        "manually using std::locale::global(std::locale(\"locale\"))\n"
                        "available locales can be queried with 'locale -a' in a terminal.";
            }
        }
    }
#endif

ofSeedRandom();
ofResetElapsedTimeCounter();
of::priv::setWorkingDirectoryToDefault();

it does successfully set the locale, but then still crashes when setting the working-directory.


Viewing all articles
Browse latest Browse all 40524


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>