1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-01-17 21:09:00 +01:00

#15 add cache directory for linux build

This commit is contained in:
XProger 2017-03-16 20:31:05 +03:00
parent 7ea7f783e9
commit 8a765fe7e0
2 changed files with 13 additions and 0 deletions

Binary file not shown.

View File

@ -1,5 +1,8 @@
#include <string.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <unistd.h>
#include <pwd.h>
#include <pthread.h>
#include <pulse/pulseaudio.h>
#include <pulse/simple.h>
@ -129,6 +132,16 @@ char Stream::contentDir[255];
int main() {
Stream::contentDir[0] = Stream::cacheDir[0] = 0;
const char *home;
if (!(home = getenv("HOME")))
home = getpwuid(getuid())->pw_dir;
strcat(Stream::cacheDir, home);
strcat(Stream::cacheDir, "/.OpenLara/");
struct stat st = {0};
if (stat(Stream::cacheDir, &st) == -1 && mkdir(Stream::cacheDir, 0777) == -1)
Stream::cacheDir[0] = 0;
static int XGLAttr[] = {
GLX_RGBA,
GLX_DOUBLEBUFFER,