Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
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 * The Original Code is: all of this file. | |
22 * | |
23 * Contributor(s): none yet. | |
24 * | |
25 * ***** END GPL LICENSE BLOCK ***** | |
26 */ | |
27 | |
28 /** \file blender/freestyle/intern/application/AppConfig.cpp | |
29 * \ingroup freestyle | |
30 */ | |
31 | |
32 #include "AppConfig.h" | |
33 #include <iostream> | |
34 | |
35 #include "../system/StringUtils.h" | |
36 | |
37 using namespace std; | |
38 | |
39 extern "C" { | |
40 #include "BLI_path_util.h" | |
41 } | |
42 | |
43 namespace Config { | |
44 | |
45 Path* Path::_pInstance = 0; | |
46 Path::Path() | |
47 { | |
48 // get the root directory | |
49 // soc | |
50 setRootDir(BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, NULL)); | |
51 | |
52 _pInstance = this; | |
53 } | |
54 | |
55 void Path::setRootDir(const string& iRootDir) | |
56 { | |
57 _ProjectDir = iRootDir + string(DIR_SEP.c_str()) + "freestyle"; | |
58 _ModelsPath = ""; | |
59 _PatternsPath = _ProjectDir + string(DIR_SEP.c_str()) + "data" + string( DIR_SEP.c_str()) + "textures" + | |
60 string(DIR_SEP.c_str()) + "variation_patterns" + string( DIR_SEP.c_str()); | |
61 _BrushesPath = _ProjectDir + string(DIR_SEP.c_str()) + "data" + string(D IR_SEP.c_str()) + "textures" + | |
62 string(DIR_SEP.c_str()) + "brushes" + string(DIR_SEP.c_st r()); | |
63 _PythonPath = _ProjectDir + string(DIR_SEP.c_str()) + "style_modules" + string(DIR_SEP.c_str()); | |
64 if (getenv("PYTHONPATH")) { | |
65 _PythonPath += string(PATH_SEP.c_str()) + string(getenv("PYTHONP ATH")); | |
66 } | |
67 #ifdef WIN32 | |
68 _BrowserCmd = "C:\\Program Files\\Internet Explorer\\iexplore.exe %s"; | |
ideasman42
2013/03/02 10:56:47
Why does freestyle need a web browser?
kjym3
2013/03/03 01:58:03
Not really necessary any more. This and the help
| |
69 #else | |
70 _BrowserCmd = "mozilla %s"; | |
71 #endif | |
72 _HelpIndexPath = _ProjectDir + string(DIR_SEP.c_str()) + "doc" + string( DIR_SEP.c_str()) + "html" + | |
73 string(DIR_SEP.c_str()) + "index.html"; | |
74 _EnvMapDir = _ProjectDir + string(DIR_SEP.c_str()) + "data" + string(DIR _SEP.c_str()) + "env_map" + | |
75 string(DIR_SEP.c_str()); | |
76 _MapsDir = _ProjectDir + string(DIR_SEP.c_str()) + "data" + string(DIR_S EP.c_str()) + "maps" + | |
77 string(DIR_SEP.c_str()); | |
78 } | |
79 | |
80 void Path::setHomeDir(const string& iHomeDir) | |
81 { | |
82 _HomeDir = iHomeDir; | |
83 } | |
84 | |
85 Path::~Path() | |
86 { | |
87 _pInstance = 0; | |
88 } | |
89 | |
90 Path* Path::getInstance() | |
91 { | |
92 return _pInstance; | |
93 } | |
94 | |
95 string Path::getEnvVar(const string& iEnvVarName) | |
96 { | |
97 string value; | |
98 if (!getenv(StringUtils::toAscii(iEnvVarName).c_str())) { | |
99 cerr << "Warning: You may want to set the $" | |
100 << StringUtils::toAscii(iEnvVarName) | |
101 << " environment variable to use Freestyle." << endl | |
102 << " Otherwise, the current directory will be used instead." | |
103 << endl; | |
104 value = "."; | |
105 } | |
106 else { | |
107 value = getenv(StringUtils::toAscii(iEnvVarName).c_str()); | |
108 } | |
109 return value; | |
110 } | |
111 | |
112 } // End of namepace Config | |
OLD | NEW |