~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to .pc/0011-fix_PATH_MAX_issue.patch/intern/ghost/intern/GHOST_SystemPathsX11.cpp

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-02-19 11:24:23 UTC
  • mfrom: (14.2.23 sid)
  • Revision ID: package-import@ubuntu.com-20140219112423-rkmaz2m7ha06d4tk
Tags: 2.69-3ubuntu1
* Merge with Debian; remaining changes:
  - Configure without OpenImageIO on armhf, as it is not available on
    Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * ***** BEGIN GPL LICENSE BLOCK *****
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or
5
 
 * modify it under the terms of the GNU General Public License
6
 
 * as published by the Free Software Foundation; either version 2
7
 
 * of the License, or (at your option) any later version. 
8
 
 *
9
 
 * This program is distributed in the hope that it will be useful,
10
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
 * GNU General Public License for more details.
13
 
 *
14
 
 * You should have received a copy of the GNU General Public License
15
 
 * along with this program; if not, write to the Free Software Foundation,
16
 
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
 
 *
18
 
 * The Original Code is Copyright (C) 2010 Blender Foundation.
19
 
 * All rights reserved.
20
 
 *
21
 
 * 
22
 
 * Contributor(s): Blender Foundation
23
 
 *
24
 
 * ***** END GPL LICENSE BLOCK *****
25
 
 */
26
 
 
27
 
/** \file ghost/intern/GHOST_SystemPathsX11.cpp
28
 
 *  \ingroup GHOST
29
 
 */
30
 
 
31
 
 
32
 
#include "GHOST_SystemPathsX11.h"
33
 
 
34
 
#include "GHOST_Debug.h"
35
 
 
36
 
// For timing
37
 
 
38
 
#include <sys/time.h>
39
 
#include <unistd.h>
40
 
 
41
 
#include <stdio.h>   /* for fprintf only */
42
 
#include <cstdlib>   /* for exit */
43
 
 
44
 
#include <pwd.h>     /* for get home without use getenv() */
45
 
#include <limits.h>  /* for PATH_MAX */
46
 
 
47
 
#ifdef PREFIX
48
 
static const char *static_path = PREFIX "/share";
49
 
#else
50
 
static const char *static_path = NULL;
51
 
#endif
52
 
 
53
 
GHOST_SystemPathsX11::GHOST_SystemPathsX11()
54
 
{
55
 
}
56
 
 
57
 
GHOST_SystemPathsX11::~GHOST_SystemPathsX11()
58
 
{
59
 
}
60
 
 
61
 
const GHOST_TUns8 *GHOST_SystemPathsX11::getSystemDir(int, const char *versionstr) const
62
 
{
63
 
        /* XXX On Debian ignore versionstr when building the system path */
64
 
        versionstr = "";
65
 
 
66
 
        /* no prefix assumes a portable build which only uses bundled scripts */
67
 
        if (static_path) {
68
 
                static char system_path[PATH_MAX];
69
 
                snprintf(system_path, sizeof(system_path), "%s/blender/%s", static_path, versionstr);
70
 
                return (GHOST_TUns8 *)system_path;
71
 
        }
72
 
 
73
 
        return NULL;
74
 
}
75
 
 
76
 
const GHOST_TUns8 *GHOST_SystemPathsX11::getUserDir(int version, const char *versionstr) const
77
 
{
78
 
        static char user_path[PATH_MAX];
79
 
 
80
 
        /* in blender 2.64, we migrate to XDG. to ensure the copy previous settings
81
 
         * operator works we give a different path depending on the requested version */
82
 
        if (version < 264) {
83
 
                const char *home = getenv("HOME");
84
 
 
85
 
                if (home) {
86
 
                        snprintf(user_path, sizeof(user_path), "%s/.blender/%s", home, versionstr);
87
 
                        return (GHOST_TUns8 *)user_path;
88
 
                }
89
 
 
90
 
                return NULL;
91
 
        }
92
 
        else {
93
 
                const char *home = getenv("XDG_CONFIG_HOME");
94
 
 
95
 
                if (home) {
96
 
                        snprintf(user_path, sizeof(user_path), "%s/blender/%s", home, versionstr);
97
 
                }
98
 
                else {
99
 
                        home = getenv("HOME");
100
 
 
101
 
                        if (home == NULL)
102
 
                                home = getpwuid(getuid())->pw_dir;
103
 
 
104
 
                        snprintf(user_path, sizeof(user_path), "%s/.config/blender/%s", home, versionstr);
105
 
                }
106
 
 
107
 
                return (const GHOST_TUns8 *)user_path;
108
 
        }
109
 
}
110
 
 
111
 
const GHOST_TUns8 *GHOST_SystemPathsX11::getBinaryDir() const
112
 
{
113
 
        return NULL;
114
 
}
115
 
 
116
 
void GHOST_SystemPathsX11::addToSystemRecentFiles(const char *filename) const
117
 
{
118
 
        /* XXXXX TODO: Implementation for X11 if possible */
119
 
 
120
 
}