From abcd6e302d0a928129db3c6505ff91b3fa6099bb Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Thu, 5 Mar 2015 19:48:47 +0000 Subject: [PATCH] Fix find minetest on windows --- src/Editor.cpp | 2 +- src/minetest.cpp | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/Editor.cpp b/src/Editor.cpp index 85deabd..226178f 100644 --- a/src/Editor.cpp +++ b/src/Editor.cpp @@ -161,7 +161,7 @@ bool Editor::run(IrrlichtDevice* irr_device, Configuration* conf, // Do sleep unsigned int now = std::clock(); if (dosleep) { - u32 sleeptime = int(double(1000) / double(65)) - (now - last); + u32 sleeptime = int(double(1000) / double(60)) - (now - last); if (sleeptime > 0 && sleeptime < 200) device->sleep(sleeptime); } diff --git a/src/minetest.cpp b/src/minetest.cpp index a733232..b4f83fd 100644 --- a/src/minetest.cpp +++ b/src/minetest.cpp @@ -22,8 +22,16 @@ bool Minetest::findMinetestDir(std::string path) std::cerr << "Minetest found at " << path.c_str() << std::endl; minetest_dir = path; - if (FileExists((path + "bin/minetest").c_str())) { - minetest_exe = path + "bin/minetest"; + if (FileExists((path + "bin" DIR_DELIM "minetest" +#if _WIN32 + ".exe" +#endif + ).c_str())) { + minetest_exe = path + "bin" DIR_DELIM "minetest" +#if _WIN32 + ".exe" +#endif + ; } else std::cerr << "...but no executable!" << std::endl; return true; @@ -66,10 +74,16 @@ bool Minetest::findMinetest(bool editor_is_installed) path = getSaveLoadDirectory(_conf->get("save_directory"), editor_is_installed); path = cleanDirectoryPath(path); - if (findMinetestDir(path + "../minetest/") && minetest_exe != "") + if (findMinetestDir(path + ".." DIR_DELIM "minetest" DIR_DELIM) && minetest_exe != "") + return true; + + if (findMinetestDir(path + "minetest" DIR_DELIM) && minetest_exe != "") + return true; + + if (findMinetestDir(path + ".." DIR_DELIM "Minetest" DIR_DELIM) && minetest_exe != "") return true; - if (findMinetestDir(path + "minetest/") && minetest_exe != "") + if (findMinetestDir(path + "Minetest" DIR_DELIM) && minetest_exe != "") return true; std::cerr << "Minetest not found!" << std::endl; @@ -127,7 +141,7 @@ bool Minetest::runMod(EditorState *state, const std::string &world) std::string mod_to = worlddir + "worldmods" DIR_DELIM + modname; CreateDir(mod_to); mod_to = cleanDirectoryPath(mod_to); - export_textures(mod_to + "textures/", state); + export_textures(mod_to + "textures" DIR_DELIM, state); FileFormat *writer = getFromType(FILE_FORMAT_LUA, state); save_file(writer, state, mod_to + "init.lua");