Update to 6762
[qball-mpd.git] / src / path.h
blob2357aa25d4178711c6a01b962828ec4e1006bfcc
1 /* the Music Player Daemon (MPD)
2 * Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
3 * This project's homepage is: http://www.musicpd.org
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef PATH_H
20 #define PATH_H
22 #include "../config.h"
24 #include <sys/param.h>
26 extern const char *musicDir;
28 void initPaths(void);
30 void finishPaths(void);
32 /* utf8ToFsCharset() and fsCharsetToUtf8()
33 * Each returns a static pointer to a dynamically allocated buffer
34 * which means:
35 * - Do not manually free the return value of these functions, it'll be
36 * automatically freed the next time it is called.
37 * - They are not reentrant, xstrdup the return value immediately if
38 * you expect to call one of these functions again, but still need the
39 * previous result.
40 * - The static pointer is unique to each function.
42 char *utf8ToFsCharset(char *str);
43 char *fsCharsetToUtf8(char *str);
45 void setFsCharset(char *charset);
47 char *getFsCharset(void);
49 /* relative music path to absolute music path
50 * char * passed is a static variable, so don't free it
52 char *rmp2amp(char *file);
54 /* static char * returned */
55 char *rpp2app(char *file);
57 /* static char * returned */
58 char *parentPath(char *path);
60 /* strips extra "///" and leading "/" and trailing "/" */
61 char *sanitizePathDup(char *path);
63 /* this is actually like strlcpy (OpenBSD), but we don't actually want to
64 * blindly use it everywhere, only for paths that are OK to truncate (for
65 * error reporting and such.
66 * dest must be MAXPATHLEN+1 bytes large (which is standard in mpd) */
67 void pathcpy_trunc(char *dest, const char *src);
69 #endif