~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to .pc/0003-install_in_usr_lib.patch/intern/ghost/intern/GHOST_SystemPathsX11.cpp

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

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
 
#ifdef WITH_XDG_USER_DIRS
45
 
#  include <pwd.h> // for get home without use getenv()
46
 
#  include <limits.h> // for PATH_MAX
47
 
#endif
48
 
 
49
 
#ifdef PREFIX
50
 
static const char *static_path= PREFIX "/share";
51
 
#else
52
 
static const char *static_path= NULL;
53
 
#endif
54
 
 
55
 
GHOST_SystemPathsX11::GHOST_SystemPathsX11()
56
 
{
57
 
}
58
 
 
59
 
GHOST_SystemPathsX11::~GHOST_SystemPathsX11()
60
 
{
61
 
}
62
 
 
63
 
const GHOST_TUns8* GHOST_SystemPathsX11::getSystemDir() const
64
 
{
65
 
        /* no prefix assumes a portable build which only uses bundled scripts */
66
 
        return (const GHOST_TUns8 *)static_path;
67
 
}
68
 
 
69
 
const GHOST_TUns8* GHOST_SystemPathsX11::getUserDir() const
70
 
{
71
 
#ifndef WITH_XDG_USER_DIRS
72
 
        return (const GHOST_TUns8 *)getenv("HOME");
73
 
#else /* WITH_XDG_USER_DIRS */
74
 
        const char *home= getenv("XDG_CONFIG_HOME");
75
 
 
76
 
        if (home) {
77
 
                return (const GHOST_TUns8 *)home;
78
 
        }
79
 
        else {
80
 
                static char user_path[PATH_MAX];
81
 
 
82
 
                home= getenv("HOME");
83
 
 
84
 
                if (home == NULL) {
85
 
                        home= getpwuid(getuid())->pw_dir;
86
 
                }
87
 
 
88
 
                snprintf(user_path, sizeof(user_path), "%s/.config", home);
89
 
                return (const GHOST_TUns8 *)user_path;
90
 
        }
91
 
#endif /* WITH_XDG_USER_DIRS */
92
 
}
93
 
 
94
 
const GHOST_TUns8* GHOST_SystemPathsX11::getBinaryDir() const
95
 
{
96
 
        return NULL;
97
 
}
98
 
 
99
 
void GHOST_SystemPathsX11::addToSystemRecentFiles(const char* filename) const
100
 
{
101
 
        /* XXXXX TODO: Implementation for X11 if possible */
102
 
 
103
 
}