OSDN Git Service

Support group affiliation with component package granularity.
[mingw/mingw-get.git] / src / xmlfile.c
1 /*
2  * xmlfile.c
3  *
4  * $Id$
5  *
6  * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
7  * Copyright (C) 2009, MinGW Project
8  *
9  *
10  * Helper function for constructing path names to the XML data files
11  * specifying the mingw-get configuration, and installation manifest.
12  *
13  *
14  * This is free software.  Permission is granted to copy, modify and
15  * redistribute this software, under the provisions of the GNU General
16  * Public License, Version 3, (or, at your option, any later version),
17  * as published by the Free Software Foundation; see the file COPYING
18  * for licensing details.
19  *
20  * Note, in particular, that this software is provided "as is", in the
21  * hope that it may prove useful, but WITHOUT WARRANTY OF ANY KIND; not
22  * even an implied WARRANTY OF MERCHANTABILITY, nor of FITNESS FOR ANY
23  * PARTICULAR PURPOSE.  Under no circumstances will the author, or the
24  * MinGW Project, accept liability for any damages, however caused,
25  * arising from the use of this software.
26  *
27  */
28 #include <stdlib.h>
29
30 #include "mkpath.h"
31
32 const char *xmlfile( const char *name, const char *modifier )
33 {
34   /* Construct a full path name for the file specified by "name",
35    * adding the mandatory ".xml" extension; the path is always based
36    * at "${APPROOT}", with "modifier" specifying an optional subdirectory
37    * of the standard path, (typically used as a temporary location for
38    * internet downloads while in transit).
39    */
40   const char *datapath = "%R" "var/lib/mingw-get/data" "%/M/%F.xml";
41   char *datafile = (char *)(malloc( mkpath( NULL, datapath, name, modifier ) ));
42
43   mkpath( datafile, datapath, name, modifier );
44   return (const char *)(datafile);
45 }
46
47 /* $RCSfile$: end of file */