add un/install targets
[sispare-qt.git] / util.hh
blob7b3e8615bd0e58924921e173c8decd7e5bc746bc
1 /*
2 * Copyright (c) 2021, S. Gilles <sgilles@sgilles.net>
4 * Permission to use, copy, modify, and/or distribute this software
5 * for any purpose with or without fee is hereby granted, provided
6 * that the above copyright notice and this permission notice appear
7 * in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
13 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
14 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
15 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #ifndef UTIL_H
19 #define UTIL_H
21 #include <filesystem>
23 namespace Util {
24 /* Find the right "~/.data/sispare" or "~/.sispare" or something */
25 extern std::filesystem::path find_data_dir();
27 /* Print exception, maybe with stack trace */
28 extern void output_nested_ex(const std::exception& e, int level = 0);
30 /* Slurp file into string (for reading A/B sides). throws on failure */
31 extern std::string slurp(const std::filesystem::path& path);
34 #endif