4
4
/* XDG Base Directory Specifications support library */
7
* Argyll Color Correction System
9
* Author: Graeme W. Gill
12
* Copyright 2010 Graeme W. Gill
13
* All rights reserved.
15
* This material is licenced under the GNU GENERAL PUBLIC LICENSE Version 2 or later :-
16
* see the License2.txt file for licencing details.
6
/*************************************************************************
7
Copyright 2011 Graeme W. Gill
9
Permission is hereby granted, free of charge, to any person obtaining a copy
10
of this software and associated documentation files (the "Software"), to deal
11
in the Software without restriction, including without limitation the rights
12
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
copies of the Software, and to permit persons to whom the Software is
14
furnished to do so, subject to the following conditions:
16
The above copyright notice and this permission notice shall be included in
17
all copies or substantial portions of the Software.
19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
*************************************************************************/
51
61
xdg_mallformed /* Malfomed path */
54
/* Return the full path to the given subpath for the type of storage */
55
/* and access required. Return NULL if there is an error. */
56
/* The string should be free()'s after use. */
64
/* Return the number of matching full paths to the given subpath for the */
65
/* type of storage and access required. Return 0 if there is an error. */
66
/* The files are always unique (ie. the first match to a given filename */
67
/* in the possible XDG list of directories is returned, and files with */
68
/* the same name in other XDG directories are ignored) */
69
/* Wildcards should only be for the filename portion, and not be used for xdg_write. */
70
/* The list should be free'd using xdg_free() after use. */
57
71
/* XDG environment variables and the subpath are assumed to be using */
58
72
/* the '/' path separator. */
59
73
/* When "xdg_write", the necessary path to the file will be created. */
61
75
/* we drop to using the underlying SUDO_UID/GID. If we are creating a */
62
76
/* local system dir/file as sudo and have dropped to the SUDO_UID/GID, */
63
77
/* then revert back to root uid/gid. */
65
79
xdg_error *er, /* Return an error code */
80
char ***paths, /* Return array of pointers to paths */
66
81
xdg_storage_type st, /* Specify the storage type */
67
82
xdg_op_type op, /* Operation type */
68
83
xdg_scope sc, /* Scope if write */
69
char *spath /* Sub-path and file name */
84
char *spath /* Sub-path and file name or file pattern */
88
void xdg_free(char **paths, int nopaths);
72
90
/* Return a string corresponding to the error value */
73
91
char *xdg_errstr(xdg_error er);
76
95
#endif /* XDG_BDS_H */