vsg  1.1.0
VulkanSceneGraph library
FileSystem.h
1 #pragma once
2 
3 /* <editor-fold desc="MIT License">
4 
5 Copyright(c) 2018 Robert Osfield
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8 
9 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10 
11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 
13 </editor-fold> */
14 
15 #include <map>
16 #include <vector>
17 
18 #include <vsg/core/Object.h>
19 #include <vsg/core/contains.h>
20 #include <vsg/io/Path.h>
21 
22 namespace vsg
23 {
24 
25  class Options;
26 
28  extern VSG_DECLSPEC std::string getEnv(const char* env_var);
29 
32  extern VSG_DECLSPEC Paths getEnvPaths(const char* env_var);
33 
35  template<typename... Args>
36  Paths getEnvPaths(const char* env_var, Args... args)
37  {
38  auto paths = getEnvPaths(env_var);
39  auto right_paths = getEnvPaths(args...);
40  paths.insert(paths.end(), right_paths.begin(), right_paths.end());
41  return paths;
42  }
43 
45  extern VSG_DECLSPEC FileType fileType(const Path& path);
46 
48  extern VSG_DECLSPEC bool fileExists(const Path& path);
49 
51  extern VSG_DECLSPEC Path findFile(const Path& filename, const Paths& paths);
52 
55  extern VSG_DECLSPEC Path findFile(const Path& filename, const Options* options);
56 
58  extern VSG_DECLSPEC bool makeDirectory(const Path& path);
59 
61  extern VSG_DECLSPEC Paths getDirectoryContents(const Path& directoryName);
62 
64  extern VSG_DECLSPEC Path executableFilePath();
65 
67  extern VSG_DECLSPEC FILE* fopen(const Path& path, const char* mode);
68 
69 } // namespace vsg