diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-01-07 19:39:27 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-01-07 19:39:27 +0200 |
commit | 6b6c2d37ea1f9075c4fbf0d7e2d52e527e1f86aa (patch) | |
tree | 16ab23387dc95d0f42e6519e500d4024e2a2f826 /src/porting.h | |
parent | dc414091e736badc6fd2faa6a2583639a3458818 (diff) | |
download | minetest-6b6c2d37ea1f9075c4fbf0d7e2d52e527e1f86aa.tar.gz minetest-6b6c2d37ea1f9075c4fbf0d7e2d52e527e1f86aa.tar.bz2 minetest-6b6c2d37ea1f9075c4fbf0d7e2d52e527e1f86aa.zip |
Added a more flexible path system (and fixed some minor stuff)
Diffstat (limited to 'src/porting.h')
-rw-r--r-- | src/porting.h | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/porting.h b/src/porting.h index 19ac5c6bb..71891de39 100644 --- a/src/porting.h +++ b/src/porting.h @@ -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" @@ -45,6 +48,33 @@ 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. Overflow can occur at any value higher than 10000000. @@ -67,5 +97,5 @@ namespace porting } // namespace porting -#endif +#endif // PORTING_HEADER |