mirror of
https://github.com/minetest/minetest.git
synced 2024-12-23 22:52:25 +01:00
MSVC build directory autodetection at startup
This commit is contained in:
parent
0557df8d06
commit
728d01ef4b
@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "debug.h"
|
||||
#include "filesys.h"
|
||||
#include "log.h"
|
||||
#include "utility_string.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "CoreFoundation/CoreFoundation.h"
|
||||
@ -144,6 +145,13 @@ void pathRemoveFile(char *path, char delim)
|
||||
path[i] = 0;
|
||||
}
|
||||
|
||||
bool detectMSVCBuildDir(char *c_path)
|
||||
{
|
||||
std::string path(c_path);
|
||||
const char *ends[] = {"bin\\Release", "bin\\Build", NULL};
|
||||
return (removeStringEnd(path, ends) != "");
|
||||
}
|
||||
|
||||
void initializePaths()
|
||||
{
|
||||
#ifdef RUN_IN_PLACE
|
||||
@ -168,8 +176,15 @@ void initializePaths()
|
||||
assert(len < buflen);
|
||||
pathRemoveFile(buf, '\\');
|
||||
|
||||
if(detectMSVCBuildDir(buf)){
|
||||
infostream<<"MSVC build directory detected"<<std::endl;
|
||||
path_share = std::string(buf) + "\\..\\..";
|
||||
path_user = std::string(buf) + "\\..\\..";
|
||||
}
|
||||
else{
|
||||
path_share = std::string(buf) + "\\..";
|
||||
path_user = std::string(buf) + "\\..";
|
||||
}
|
||||
|
||||
/*
|
||||
Linux
|
||||
|
Loading…
Reference in New Issue
Block a user