forked from Mirrorlandia_minetest/minetest
Move setenv compat code to porting.h
This commit is contained in:
parent
133f706bf3
commit
6f494a968d
@ -20,15 +20,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdlib>
|
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "util/string.h"
|
#include "util/string.h"
|
||||||
|
#include "porting.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#define setenv(n,v,o) _putenv_s(n,v)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USE_GETTEXT && defined(_MSC_VER)
|
#if USE_GETTEXT && defined(_MSC_VER)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -23,6 +23,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#if (defined(__linux__) || defined(__GNU__)) && !defined(_GNU_SOURCE)
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "irrlicht.h"
|
#include "irrlicht.h"
|
||||||
@ -43,12 +47,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
#define sleep_ms(x) Sleep(x)
|
#define sleep_ms(x) Sleep(x)
|
||||||
#define sleep_us(x) Sleep((x)/1000)
|
#define sleep_us(x) Sleep((x)/1000)
|
||||||
|
|
||||||
|
#define setenv(n,v,o) _putenv_s(n,v)
|
||||||
|
#define unsetenv(n) _putenv_s(n,"")
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <cstdlib> // setenv
|
||||||
#if (defined(__linux__) || defined(__GNU__)) && !defined(_GNU_SOURCE)
|
|
||||||
#define _GNU_SOURCE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define sleep_ms(x) usleep((x)*1000)
|
#define sleep_ms(x) usleep((x)*1000)
|
||||||
#define sleep_us(x) usleep(x)
|
#define sleep_us(x) usleep(x)
|
||||||
|
@ -67,15 +67,7 @@ void TestServerModManager::runTests(IGameDef *gamedef)
|
|||||||
ofs2 << "-- intentionally empty\n";
|
ofs2 << "-- intentionally empty\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
{
|
|
||||||
std::string mod_path("MINETEST_MOD_PATH=");
|
|
||||||
mod_path.append(test_mods);
|
|
||||||
_putenv(mod_path.c_str());
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
setenv("MINETEST_MOD_PATH", test_mods.c_str(), 1);
|
setenv("MINETEST_MOD_PATH", test_mods.c_str(), 1);
|
||||||
#endif
|
|
||||||
|
|
||||||
m_worlddir = getTestTempDirectory().append(DIR_DELIM "world");
|
m_worlddir = getTestTempDirectory().append(DIR_DELIM "world");
|
||||||
fs::CreateDir(m_worlddir);
|
fs::CreateDir(m_worlddir);
|
||||||
|
Loading…
Reference in New Issue
Block a user