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 (C) 2012-2014 Open Source Robotics Foundation
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 
40 
41 namespace gazebo
42 {
43  namespace common
44  {
47 
57  class SystemPaths : public SingletonT<SystemPaths>
58  {
60  private: SystemPaths();
61 
64  public: std::string GetLogPath() const;
65 
68  public: const std::list<std::string> &GetGazeboPaths();
69 
72  public: const std::list<std::string> &GetOgrePaths();
73 
76  public: const std::list<std::string> &GetPluginPaths();
77 
80  public: const std::list<std::string> &GetModelPaths();
81 
84  public: std::string GetWorldPathExtension();
85 
89  public: std::string FindFileURI(const std::string &_uri);
90 
96  public: std::string FindFile(const std::string &_filename,
97  bool _searchLocalPath = true);
98 
101  public: void AddGazeboPaths(const std::string &_path);
102 
105  public: void AddModelPaths(const std::string &_path);
106 
109  public: void AddOgrePaths(const std::string &_path);
110 
113  public: void AddPluginPaths(const std::string &_path);
114 
116  public: void ClearGazeboPaths();
118  public: void ClearModelPaths();
120  public: void ClearOgrePaths();
122  public: void ClearPluginPaths();
123 
126  public: void AddSearchPathSuffix(const std::string &_suffix);
127 
129  private: void UpdateModelPaths();
131  private: void UpdateGazeboPaths();
133  private: void UpdatePluginPaths();
135  private: void UpdateOgrePaths();
136 
140  private: void InsertUnique(const std::string &_path,
141  std::list<std::string> &_list);
142 
144  private: std::list<std::string> gazeboPaths;
145 
147  private: std::list<std::string> ogrePaths;
148 
150  private: std::list<std::string> pluginPaths;
151 
152  private: std::list<std::string> suffixPaths;
153 
154  private: std::list<std::string> modelPaths;
155 
156  private: std::string logPath;
157 
159  public: bool modelPathsFromEnv;
160 
162  public: bool gazeboPathsFromEnv;
163 
165  public: bool pluginPathsFromEnv;
166 
168  public: bool ogrePathsFromEnv;
169 
170  private: friend class SingletonT<SystemPaths>;
171  };
173  }
174 }
175 #endif