~ubuntu-branches/ubuntu/trusty/manaplus/trusty

« back to all changes in this revision

Viewing changes to src/utils/paths.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2013-11-18 15:19:44 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20131118151944-iyd93ut2rmxzp8gg
Tags: 1.3.11.10-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
#include "resources/resourcemanager.h"
32
32
 
 
33
#ifdef __native_client__
 
34
#include <limits.h>
 
35
#define realpath(N, R) strcpy(R, N)
 
36
#endif
 
37
 
33
38
#ifdef WIN32
34
39
#include "utils/specialfolder.h"
35
40
#define realpath(N, R) _fullpath((R), (N), _MAX_PATH)
36
41
#elif defined __OpenBSD__
37
42
#include <limits>
 
43
#elif defined __native_client__
 
44
#include <limits.h>
38
45
#endif
39
46
 
40
47
#ifdef ANDROID
45
52
 
46
53
#include "debug.h"
47
54
 
 
55
namespace
 
56
{
 
57
    std::string mPackageDir;
 
58
}  // namespace
 
59
 
48
60
std::string getRealPath(const std::string &str)
49
61
{
50
 
#if defined(__OpenBSD__) || defined(__ANDROID__)
 
62
#if defined(__OpenBSD__) || defined(__ANDROID__) || defined(__native_client__)
51
63
    char *realPath = reinterpret_cast<char*>(calloc(PATH_MAX, sizeof(char)));
 
64
    if (!realPath)
 
65
        return "";
52
66
    realpath(str.c_str(), realPath);
53
67
#else
54
68
    char *realPath = realpath(str.c_str(), nullptr);
186
200
    return getenv("DATADIR2");
187
201
}
188
202
#endif
 
203
 
 
204
std::string getPackageDir()
 
205
{
 
206
    return mPackageDir;
 
207
}
 
208
 
 
209
void setPackageDir(const std::string &dir)
 
210
{
 
211
    mPackageDir = dir;
 
212
}