BibleTime
directory.h
Go to the documentation of this file.
1/*********
2*
3* In the name of the Father, and of the Son, and of the Holy Spirit.
4*
5* This file is part of BibleTime's source code, https://bibletime.info/
6*
7* Copyright 1999-2025 by the BibleTime developers.
8* The BibleTime source code is licensed under the GNU General Public License
9* version 2.0.
10*
11**********/
12
13#pragma once
14
15#include <cstddef>
16#include <QtGlobal>
17#include <QString>
18
19
20class QDir;
21
22namespace util {
23
24/**
25 * Tools for working with directories.
26*/
27namespace directory {
28
29/**
30 \brief Initializes the directory cache and returns whether it was successful.
31 \note When this function returns unsuccessfully, the program should exit.
32*/
34
35/** Returns the size of the directory including the size of all its files
36 * and its subdirs.
37 *
38 * \todo Check if it's suitable for huge dir trees, as it holds a QDir object
39 * for each of it at the same time in the deepest recursion.
40 * For really deep dir tree this may lead to a stack overflow.
41 *
42 * @return The size of the dir in bytes
43 */
44::qint64 getDirSizeRecursive(QString const & dir);
45
46#ifdef Q_OS_WIN
47/** Return the path to the sword dir., Windows only
48 C:\Program Files\BibleTime\share\sword
49 */
50const QDir &getApplicationSwordDir();
51
52/** Return the path to the shared Sword directory */
53const QDir &getSharedSwordDir();
54#endif
55
56/** Return the path to the icons. */
57const QDir &getIconDir();
58
59/** Return the path to the license. */
60QString const & getLicensePath();
61
62/** Return the path to the pictures. */
63const QDir &getPicsDir();
64
65/** Return the path to the translation files. */
66const QDir &getLocaleDir();
67
68/** \returns an absolute path to a handbook or QString() if not found. */
69QString getHandbook();
70
71/** \returns an absolute path to a howto or QString() if not found. */
72QString getHowto();
73
74/** Return the path to the default display template files. */
75const QDir &getDisplayTemplatesDir();
76
77/** Return the path to the user's home directory.
78 %APPDATA% on Windows
79 $HOME on linux */
80const QDir &getUserHomeDir();
81
82/** Return the path to the user's home .sword (or Sword) directory.
83 %APPDATA%\Sword on Windows
84 $HOME\.sword on linux */
85const QDir &getUserHomeSwordDir();
86
87/** Return the path to the user's settings directory.*/
88const QDir &getUserBaseDir();
89
90/** Return the path to the user's cache directory.*/
91const QDir &getUserCacheDir();
92
93/** Return the path to the user's indices directory.*/
94const QDir &getUserIndexDir();
95
96/** Return the path to the user's custom display templates directory.*/
97const QDir &getUserDisplayTemplatesDir();
98
99} // namespace directory
100} // namespace util
const QDir & getLocaleDir()
const QDir & getUserCacheDir()
QString getHandbook()
const QDir & getUserHomeSwordDir()
QString const & getLicensePath()
QDir const & getIconDir()
const QDir & getDisplayTemplatesDir()
const QDir & getUserHomeDir()
const QDir & getUserIndexDir()
::qint64 getDirSizeRecursive(QString const &dir)
bool initDirectoryCache()
Initializes the directory cache and returns whether it was successful.
Definition directory.cpp:59
const QDir & getUserBaseDir()
const QDir & getUserDisplayTemplatesDir()
const QDir & getPicsDir()
QString getHowto()