annotate src/ljpath.h @ 2:80a2761bd3a4

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