1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Added a more flexible path system (and fixed some minor stuff)

This commit is contained in:
Perttu Ahola 2011-01-07 19:39:27 +02:00
parent dc414091e7
commit 6b6c2d37ea
22 changed files with 356 additions and 111 deletions

View file

@ -24,8 +24,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef PORTING_HEADER
#define PORTING_HEADER
#include <string>
// Included for u64 and such
#include "common_irrlicht.h"
#include "debug.h"
#include "constants.h"
#ifdef _WIN32
#define SWPRINTF_CHARSTRING L"%S"
@ -44,6 +47,33 @@ with this program; if not, write to the Free Software Foundation, Inc.,
namespace porting
{
/*
Path of static data directory.
*/
extern std::string path_data;
/*
Directory for storing user data. Examples:
Windows: "C:\Documents and Settings\user\Application Data\<APPNAME>"
Linux: "~/.<APPNAME>"
Mac: "~/Library/Application Support/<APPNAME>"
*/
extern std::string path_userdata;
/*
Get full path of stuff in data directory.
Example: "stone.png" -> "../data/stone.png"
*/
inline std::string getDataPath(const char *subpath)
{
return path_data + "/" + subpath;
}
/*
Initialize path_data and path_userdata.
*/
void initializePaths();
/*
Resolution is 10-20ms.
Remember to check for overflows.
@ -67,5 +97,5 @@ namespace porting
} // namespace porting
#endif
#endif // PORTING_HEADER