MinGfx Toolkit  1.0
A minimal library for writing cross-platform (Windows, OSX, linux) graphics programs.
platform.h
Go to the documentation of this file.
1 /*
2  This file is part of the MinGfx Project.
3 
4  Copyright (c) 2017,2018 Regents of the University of Minnesota.
5  All Rights Reserved.
6 
7  Original Author(s) of this File:
8  Dan Keefe, 2018, University of Minnesota
9 
10  Author(s) of Significant Updates/Modifications to the File:
11  ...
12  */
13 
14 #ifndef SRC_PLATFORM_H_
15 #define SRC_PLATFORM_H_
16 
17 #include <string>
18 #include <vector>
19 
20 namespace mingfx {
21 
22 
26 class Platform {
27 public:
28 
30  static bool FileExists(const std::string &filename);
31 
32  /* Looks for a file named basename in each of the paths specified. If found,
33  the full path to the file is returned. If not found, then basename is returned.
34  Example:
35  ~~~
36  std::vector<std::string> search_path;
37  search_path.push_back(".");
38  search_path.push_back("./data");
39  search_path.push_back("./shaders");
40  search_path.push_back("/usr/local/share/blah/blah/data");
41 
42  std::string file = Platform::findFile("mydata.csv", search_path);
43  ~~~
44  */
45  static std::string FindFile(const std::string &basename, const std::vector<std::string> &searchpath);
46 
47  /* Looks for a file named basename in each of the paths specified in a semi-colon
48  separated list. If found, the full path to the file is returned. If not found,
49  then basename is returned. Example:
50  ~~~
51  std::string search_path = ".;./data;./shaders;/usr/local/share/blah/blah/data";
52  std::string file = Platform::findFile("mydata.csv", search_path);
53  ~~~
54  */
55  static std::string FindFile(const std::string &basename, const std::string &searchpath);
56 
65  static std::string FindMinGfxDataFile(const std::string &basename);
66 
75  static std::string FindMinGfxShaderFile(const std::string &basename);
76 
77 private:
78 };
79 
80 
81 } // end namespace
82 
83 #endif
Provides access to the underlying file system and other platform-specific routines.
Definition: platform.h:26
static std::string FindFile(const std::string &basename, const std::string &searchpath)
static bool FileExists(const std::string &filename)
True if filename is found and can be opened for reading on the system.
static std::string FindMinGfxDataFile(const std::string &basename)
Searches for a data file that ships with MinGfx.
static std::string FindFile(const std::string &basename, const std::vector< std::string > &searchpath)
static std::string FindMinGfxShaderFile(const std::string &basename)
Searches for a shader file that ships with MinGfx.
Namespace for the MinGfx Toolkit.
Definition: aabb.h:21