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 2012 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 
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 AddOgrePaths(const std::string &_path);
106 
109  public: void AddPluginPaths(const std::string &_path);
110 
112  public: void ClearGazeboPaths();
114  public: void ClearOgrePaths();
116  public: void ClearPluginPaths();
117 
120  public: void AddSearchPathSuffix(const std::string &_suffix);
121 
123  private: void UpdateModelPaths();
125  private: void UpdateGazeboPaths();
127  private: void UpdatePluginPaths();
129  private: void UpdateOgrePaths();
130 
134  private: void InsertUnique(const std::string &_path,
135  std::list<std::string> &_list);
136 
138  private: std::list<std::string> gazeboPaths;
139 
141  private: std::list<std::string> ogrePaths;
142 
144  private: std::list<std::string> pluginPaths;
145 
146  private: std::list<std::string> suffixPaths;
147 
148  private: std::list<std::string> modelPaths;
149 
150  private: std::string logPath;
151 
153  public: bool modelPathsFromEnv;
154 
156  public: bool gazeboPathsFromEnv;
157 
159  public: bool pluginPathsFromEnv;
160 
162  public: bool ogrePathsFromEnv;
163 
164  private: friend class SingletonT<SystemPaths>;
165  };
167  }
168 }
169 #endif
170 
171