dungeon_crawler
view prototype/src/datapath.cc @ 5:252a00508411
more stuff
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 12 Aug 2012 07:07:57 +0300 |
parents | |
children | 91180ee7b7d9 |
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 const char *datafile_path(const char *fname)
14 {
15 static std::string res;
17 for(auto path : pathlist) {
18 res = path + "/" + std::string(fname);
19 FILE *fp = fopen(res.c_str(), "r");
20 if(fp) {
21 fclose(fp);
22 return res.c_str();
23 }
24 }
25 return 0;
26 }