| 1 |
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- |
| 2 |
// XDG.hh for Blackbox - an X11 Window manager |
| 3 |
// Copyright (c) 2001 - 2005 Sean 'Shaleh' Perry <[email protected]> |
| 4 |
// Copyright (c) 1997 - 2000, 2002 - 2005 |
| 5 |
// Bradley T Hughes <bhughes at trolltech.com> |
| 6 |
// |
| 7 |
// Permission is hereby granted, free of charge, to any person obtaining a |
| 8 |
// copy of this software and associated documentation files (the "Software"), |
| 9 |
// to deal in the Software without restriction, including without limitation |
| 10 |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 11 |
// and/or sell copies of the Software, and to permit persons to whom the |
| 12 |
// Software is furnished to do so, subject to the following conditions: |
| 13 |
// |
| 14 |
// The above copyright notice and this permission notice shall be included in |
| 15 |
// all copies or substantial portions of the Software. |
| 16 |
// |
| 17 |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 |
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 20 |
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 |
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 22 |
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 23 |
// DEALINGS IN THE SOFTWARE. |
| 24 |
|
| 25 |
#ifndef __XDG_hh |
| 26 |
#define __XDG_hh |
| 27 |
|
| 28 |
#include <list> |
| 29 |
#include <string> |
| 30 |
|
| 31 |
namespace bt { |
| 32 |
|
| 33 |
namespace XDG { |
| 34 |
|
| 35 |
class BaseDir |
| 36 |
{ |
| 37 |
public: |
| 38 |
/* |
| 39 |
This is an interface for basedir-spec 0.6 found at |
| 40 |
http://www.freedesktop.org/wiki/Standards_2fbasedir_2dspec |
| 41 |
*/ |
| 42 |
static std::string dataHome(); |
| 43 |
static std::string configHome(); |
| 44 |
static std::list<std::string> dataDirs(); |
| 45 |
static std::list<std::string> configDirs(); |
| 46 |
static std::string cacheHome(); |
| 47 |
|
| 48 |
/* |
| 49 |
These functions return an absolute path to where a particular |
| 50 |
type of file can be written, creating directories as needed. |
| 51 |
All return an empty string if nothing can be written |
| 52 |
(i.e. destination directory does not exist and could not be |
| 53 |
created). |
| 54 |
*/ |
| 55 |
static std::string writeDataFile(const std::string &filename); |
| 56 |
static std::string writeConfigFile(const std::string &filename); |
| 57 |
static std::string writeCacheFile(const std::string &filename); |
| 58 |
}; |
| 59 |
|
| 60 |
} // namespace XDG |
| 61 |
|
| 62 |
} // namespace bt |
| 63 |
|
| 64 |
#endif // __XDG_hh |