Mercurial > hg > index.fcgi > lj > lj046
comparison src/ljpath.h @ 3:17286938e22a
change DS alt. rotate key to rotate twice
author | paulo@localhost |
---|---|
date | Wed, 08 Apr 2009 21:50:13 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:54a430852b25 |
---|---|
1 /* | |
2 ljpath - functions to support an application that can be | |
3 installed to either a read-write folder ("portable" config) | |
4 or to a read-only folder ("installed" config) | |
5 | |
6 Copyright 2008 Damian Yerrick | |
7 | |
8 Insert zlib license here. | |
9 | |
10 */ | |
11 | |
12 #ifndef LJPATH_H | |
13 #define LJPATH_H | |
14 | |
15 #ifdef __cplusplus | |
16 #include <cstdio> | |
17 using std::FILE; | |
18 extern "C" | |
19 { | |
20 #define DISTINCT | |
21 #else | |
22 #include <stdio.h> | |
23 #define DISTINCT restrict | |
24 #endif | |
25 | |
26 /** | |
27 * Sets up the paths used by ljfopen(). | |
28 * Determines whether the program is marked as "installed", by | |
29 * the presence of a file called installed.ini in the folder | |
30 * containing the executable file. If so, uses a folder in the | |
31 * user's home directory instead of the current directory for | |
32 * writable files. | |
33 * @param argv0 the executable file's path | |
34 * @return nonzero for installed; zero for portable | |
35 */ | |
36 int ljpathInit(const char *argv0); | |
37 | |
38 /** | |
39 * Sets the skin folder to the folder containing a file. For instance, | |
40 * in a skinnable falling block game, this would be the folder holding | |
41 * the .skin file that describes the path to each graphic used for the | |
42 * game display. | |
43 * @param filename the name of the file | |
44 */ | |
45 void ljpathSetSkinFolder(const char *filename); | |
46 | |
47 /** | |
48 * Searches for a file in read-write, skin, and read-only folders | |
49 * @param dst pointer to a PATH_MAX-byte buffer to hold the path | |
50 * @param filename the name of the file that will be searched for | |
51 * @return nonzero if the file was found; 0 if not found | |
52 */ | |
53 int ljpathFind_r(char *DISTINCT dst, const char *DISTINCT filename); | |
54 | |
55 int ljpathFind_w(char *DISTINCT dst, const char *DISTINCT filename); | |
56 | |
57 /** | |
58 * Searches for a file and opens it. After it is opened, the | |
59 * caller may use stdio.h operations on it and must close it. | |
60 * Files being read are searched for using ljpathFind_r; others are | |
61 * searched for using ljpathFind_r | |
62 * @param filename the name of the file that will be searched for | |
63 * @param mode the stdio mode (r, w, a, rb, wb, ab) | |
64 * @return a magic cookie suitable for passing to stdio.h if the file | |
65 * was opened; 0 if not opened | |
66 */ | |
67 FILE *ljfopen(const char *DISTINCT filename, const char *DISTINCT mode); | |
68 | |
69 | |
70 #ifdef __cplusplus | |
71 } | |
72 #endif | |
73 | |
74 #endif |