Debian Codegraph @

src/resources.cpp

raw
1 /**
2 * Locate and load resources
3
4 * Copyright (C) 2007, 2008, 2009, 2015 Sylvain Beucler
5
6 * This file is part of GNU FreeDink
7
8 * GNU FreeDink is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 3 of the
11 * License, or (at your option) any later version.
12
13 * GNU FreeDink is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
21 */
22
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26
27 #include "resources.h"
28 #include "paths.h"
29
30 SDL_RWops* find_resource_as_rwops(char *name)
31 {
32 SDL_RWops* rwops = NULL;
33
34 /** curdir, pkgdatadir **/
35 FILE *in = NULL;
36 if (in == NULL)
37 in = paths_pkgdatafile_fopen(name, "rb");
38
39 #ifdef __ANDROID__
40 /* Get from .apk */
41 #endif
42
43 if (in != NULL)
44 rwops = SDL_RWFromFP(in, /*autoclose=*/SDL_TRUE);
45
46 if (rwops != NULL)
47 return rwops;
48
49 /** Not found! **/
50 return NULL;
51 }