Skip to content
This repository has been archived by the owner on Dec 3, 2020. It is now read-only.

Commit

Permalink
Fix find minetest on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Mar 5, 2015
1 parent 0df5c41 commit abcd6e3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
24 changes: 19 additions & 5 deletions src/minetest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");

Expand Down

0 comments on commit abcd6e3

Please sign in to comment.