dungeon_crawler

view prototype/src/datapath.cc @ 74:5981917093ff

color grading palette output done, all is left is the input
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 21 Oct 2012 15:56:47 +0300
parents 91180ee7b7d9
children
line source
1 #include <stdio.h>
2 #include <vector>
3 #include <string>
4 #include "datapath.h"
6 static std::vector<std::string> pathlist;
8 void add_data_path(const char *path)
9 {
10 pathlist.push_back(path);
11 }
13 std::string datafile_path(const char *fname)
14 {
15 std::string res;
16 if(!fname) {
17 return res;
18 }
20 for(auto path : pathlist) {
21 res = path + "/" + std::string(fname);
22 FILE *fp = fopen(res.c_str(), "r");
23 if(fp) {
24 fclose(fp);
25 return res;
26 }
27 }
28 return std::string(fname);
29 }