fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
1/*****************************************************************************
2 * pce *
3 *****************************************************************************/
4
5/*****************************************************************************
6 * File name: src/lib/path.h *
7 * Created: 2008-11-06 by Hampa Hug <hampa@hampa.ch> *
8 * Copyright: (C) 2008-2009 Hampa Hug <hampa@hampa.ch> *
9 *****************************************************************************/
10
11/*****************************************************************************
12 * This program is free software. You can redistribute it and / or modify it *
13 * under the terms of the GNU General Public License version 2 as published *
14 * by the Free Software Foundation. *
15 * *
16 * This program is distributed in the hope that it will be useful, but *
17 * WITHOUT ANY WARRANTY, without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
19 * Public License for more details. *
20 *****************************************************************************/
21
22
23#ifndef PCE_LIB_PATH_H
24#define PCE_LIB_PATH_H 1
25
26
27#include <libini/libini.h>
28
29
30/*!***************************************************************************
31 * @short Clear the search path
32 *****************************************************************************/
33void pce_path_clear (void);
34
35/*!***************************************************************************
36 * @short Add a directory to the search path
37 * @param dir The directory
38 * @param atend If true, add the directory at the end of the path, otherwise
39 * add it to the beginning.
40 *****************************************************************************/
41int pce_path_add (const char *dir, int atend);
42
43/*!***************************************************************************
44 * @short Add a directory to the search path
45 * @param dir The directory
46 *
47 * The first character of dir determines where the directory is added:
48 * '+': at end
49 * '-': at beginning
50 * '=': clear before adding
51 *****************************************************************************/
52int pce_path_set (const char *dir);
53
54/*!***************************************************************************
55 * @short Get a path
56 * @param fname The file name
57 * @return The path name or NULL if fname is NULL
58 *
59 * This function looks for a file named fname in every directory of the
60 * search path. If a file is found its full path is returned. If no file
61 * is found a copy of fname is returned.
62 *****************************************************************************/
63char *pce_path_get (const char *fname);
64
65/*!***************************************************************************
66 * @short Open a file for input
67 *****************************************************************************/
68FILE *pce_fopen_inp (const char *fname, const char *mode, char **path);
69
70FILE *pce_fopen_out (const char *fname, const char *mode);
71
72/*!***************************************************************************
73 * @short Add all "path" entries from an ini section to the search path
74 *****************************************************************************/
75int pce_path_ini (ini_sct_t *sct);
76
77
78#endif