All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SystemPaths.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Nate Koenig
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 /* Desc: Gazebo configuration on this computer
18  * Date: 3 May 2008
19  */
20 
21 #ifndef _GAZEBO_SYSTEMPATHS_HH_
22 #define _GAZEBO_SYSTEMPATHS_HH_
23 
24 #include <stdio.h>
25 
26 #define LINUX
27 #ifdef WINDOWS
28  #include <direct.h>
29  #define GetCurrentDir _getcwd
30 #else
31  #include <unistd.h>
32  #define GetCurrentDir getcwd
33 #endif
34 
35 #include <string>
36 #include <list>
37 
38 #include "common/CommonTypes.hh"
39 #include "common/SingletonT.hh"
40 
41 namespace gazebo
42 {
43  namespace common
44  {
47 
56  class SystemPaths : public SingletonT<SystemPaths>
57  {
59  private: SystemPaths();
60 
63  public: std::string GetLogPath() const;
64 
67  public: const std::list<std::string> &GetGazeboPaths();
68 
71  public: const std::list<std::string> &GetOgrePaths();
72 
75  public: const std::list<std::string> &GetPluginPaths();
76 
79  public: const std::list<std::string> &GetModelPaths();
80 
83  public: std::string GetWorldPathExtension();
84 
87  public: std::string FindFileURI(const std::string &_uri);
88 
93  public: std::string FindFile(const std::string &_filename,
94  bool _searchLocalPath = true);
95 
98  public: void AddGazeboPaths(const std::string &_path);
99 
102  public: void AddOgrePaths(const std::string &_path);
103 
106  public: void AddPluginPaths(const std::string &_path);
107 
109  public: void ClearGazeboPaths();
111  public: void ClearOgrePaths();
113  public: void ClearPluginPaths();
114 
116  public: void AddSearchPathSuffix(const std::string &_suffix);
117 
119  private: void UpdateModelPaths();
121  private: void UpdateGazeboPaths();
123  private: void UpdatePluginPaths();
125  private: void UpdateOgrePaths();
126 
130  private: void InsertUnique(const std::string &_path,
131  std::list<std::string> &_list);
132 
134  private: std::list<std::string> gazeboPaths;
135 
137  private: std::list<std::string> ogrePaths;
138 
140  private: std::list<std::string> pluginPaths;
141 
142  private: std::list<std::string> suffixPaths;
143 
144  private: std::list<std::string> modelPaths;
145 
146  private: std::string logPath;
147 
149  public: bool modelPathsFromEnv;
150 
152  public: bool gazeboPathsFromEnv;
153 
155  public: bool pluginPathsFromEnv;
156 
158  public: bool ogrePathsFromEnv;
159 
160  private: friend class SingletonT<SystemPaths>;
161  };
163  }
164 }
165 #endif
166 
167