Hi, I've coded a custom filedialog, the problem is when my std::string contains the character 'é' by example, the character is removed by sf::String and it fails to open my file.
std::string Label::getText() {
return text.getString().toAnsiString();
}
std::string currentDir = lTop.getText();
std::cout<<fileName<<std::endl;
currentDir += "/"+fileName;
std::cout<<currentDir<<std::endl;
std::string currentDir = lTop.getText();
std::cout<<fileName<<std::endl;
currentDir += "/"+fileName;
std::cout<<currentDir<<std::endl;
lTop.setText(currentDir);
if (DIR* current = opendir(currentDir.c_str())) {
By exemple sf::String replace développement by dveloppement and I get a no such file or directory error. (Wtf
)
So I've just changed the type of sf::String to std::string into the sf::Text class and now it works.
There isn't any unicode version of the opendir function, so I really suggest you to don't remove unknow characters for ansi strings.