2020-09-30 05:55:53 +02:00
|
|
|
#ifndef PLATFORM_H
|
|
|
|
#define PLATFORM_H
|
|
|
|
|
2020-11-24 11:14:47 +01:00
|
|
|
#include "STRINGS.H"
|
|
|
|
|
2020-09-30 05:55:53 +02:00
|
|
|
#ifdef _WIN32
|
2020-11-19 16:48:39 +01:00
|
|
|
|
2020-09-30 05:55:53 +02:00
|
|
|
#include <direct.h>
|
2020-11-19 16:48:39 +01:00
|
|
|
|
2020-10-10 20:03:53 +02:00
|
|
|
#define HOME_ENV "USERPROFILE"
|
2020-11-19 16:48:39 +01:00
|
|
|
|
|
|
|
inline void FixPathSlashes(char* pathbuff)
|
|
|
|
{
|
|
|
|
while (*pathbuff)
|
|
|
|
{
|
|
|
|
if (*pathbuff == '/') // make windows-style path
|
|
|
|
*pathbuff = '\\';
|
|
|
|
pathbuff++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 05:55:53 +02:00
|
|
|
#elif defined (__unix__)
|
2020-11-19 16:48:39 +01:00
|
|
|
|
2020-09-30 05:55:53 +02:00
|
|
|
#include <sys/stat.h>
|
2020-11-19 16:48:39 +01:00
|
|
|
|
2020-10-10 20:03:53 +02:00
|
|
|
#define HOME_ENV "HOME"
|
2020-09-30 05:55:53 +02:00
|
|
|
#define _mkdir(str) mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)
|
2020-10-03 23:28:04 +02:00
|
|
|
|
2020-11-19 16:48:39 +01:00
|
|
|
inline void FixPathSlashes(char* pathbuff)
|
2020-10-03 23:28:04 +02:00
|
|
|
{
|
|
|
|
while (*pathbuff)
|
|
|
|
{
|
2020-11-19 16:48:39 +01:00
|
|
|
if (*pathbuff == '\\') // make unix-style path
|
|
|
|
*pathbuff = '/';
|
2020-10-03 23:28:04 +02:00
|
|
|
pathbuff++;
|
|
|
|
}
|
|
|
|
}
|
2020-09-30 05:55:53 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
#define _stricmp(s1, s2) strcasecmp(s1, s2)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // PLATFORM_H
|