forked from jaildesigner-jailgames/jaildoctors_dilemma
Ya crea correctamente la carpeta de sistema en las tres plataformas
This commit is contained in:
@@ -2,11 +2,8 @@
|
|||||||
#include "director.h"
|
#include "director.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@@ -280,23 +277,26 @@ bool Director::saveConfig()
|
|||||||
void Director::createSystemFolder()
|
void Director::createSystemFolder()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
systemFolder = std::string(getenv("APPDATA")) + "/jaildoctors_dilemma";
|
systemFolder = std::string(getenv("APPDATA")) + "/jailgames/jaildoctors_dilemma";
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
struct passwd *pw = getpwuid(getuid());
|
struct passwd *pw = getpwuid(getuid());
|
||||||
const char *homedir = pw->pw_dir;
|
const char *homedir = pw->pw_dir;
|
||||||
systemFolder = std::string(homedir) + "/Library/Application Support/jaildoctors_dilemma";
|
systemFolder = std::string(homedir) + "/Library/Application Support/jailgames/jaildoctors_dilemma";
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
struct passwd *pw = getpwuid(getuid());
|
struct passwd *pw = getpwuid(getuid());
|
||||||
const char *homedir = pw->pw_dir;
|
const char *homedir = pw->pw_dir;
|
||||||
systemFolder = std::string(homedir) + "/.jaildoctors_dilemma";
|
systemFolder = std::string(homedir) + "/.jailgames/jaildoctors_dilemma";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct stat st = {0};
|
struct stat st = {0};
|
||||||
if (stat(systemFolder.c_str(), &st) == -1)
|
if (stat(systemFolder.c_str(), &st) == -1)
|
||||||
{
|
{
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
#ifdef _WIN32
|
||||||
int ret = mkdir(systemFolder.c_str());
|
int ret = mkdir(systemFolder.c_str());
|
||||||
//int ret = mkdir(systemFolder.c_str(), S_IRWXU);
|
#else
|
||||||
|
int ret = mkdir(systemFolder.c_str(), S_IRWXU);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user