}
// Detect datadir with some linux magic
-#ifndef WIN32
if(datadir.empty()) {
+ std::string exedir;
+#ifdef WIN32
+ exedir = ".";
+#else
char exe_file[PATH_MAX];
- if(readlink("/proc/self/exe", exe_file, PATH_MAX) < 0) {
+ if(readlink("/proc/self/exe", exe_file, PATH_MAX) >= 0) {
+ exedir = std::string(dirname(exe_file));
+ } else {
#ifdef DEBUG
std::cerr << "Couldn't read /proc/self/exe \n";
#endif
- } else {
- std::string exedir = std::string(dirname(exe_file)) + "/";
- std::string testdir = exedir + "./data/";
- if(access(testdir.c_str(), F_OK) == 0) {
- datadir = testdir;
- }
-
- testdir = exedir + "../share/supertux/";
- if(datadir.empty() && access(testdir.c_str(), F_OK) == 0) {
- datadir = testdir;
- }
- }
- }
+ exedir = ".";
+ }
#endif
+ std::string testdir = exedir + "/data/";
+ if(access(testdir.c_str(), F_OK) == 0) {
+ datadir = testdir;
+ }
+
+ testdir = exedir + "/../share/supertux/";
+ if(datadir.empty() && access(testdir.c_str(), F_OK) == 0) {
+ datadir = testdir;
+ }
+ }
#ifdef DATA_PREFIX
// use default location
static void init_tinygettext()
{
dictionary_manager.add_directory(datadir + "/locale");
- dictionary_manager.set_charset("ISO8859-1");
+ dictionary_manager.set_charset("UTF-8");
}
static void print_usage(const char* argv0)