dungeon_crawler
view prototype/src/datapath.cc @ 14:67ae9fcb802c
loading normal map
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 19 Aug 2012 06:30:18 +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 }