Revert "Removed getDataDirectory()"

This commit is contained in:
Matthieu Gautier
2024-08-12 16:22:01 +02:00
committed by GitHub
parent 0ea756c42a
commit 5a73a75798
7 changed files with 96 additions and 18 deletions

View File

@ -172,12 +172,7 @@ class Downloader
typedef std::vector<std::pair<std::string, std::string>> Options;
public: // functions
/*
* Create a new Downloader object.
*
* @param sessionFileDir: The directory where aria2 will store its session file.
*/
explicit Downloader(std::string sessionFileDir);
Downloader();
virtual ~Downloader();
void close();
@ -196,11 +191,10 @@ class Downloader
* User should call `update` on the returned `Download` to have an accurate status.
*
* @param uri: The uri of the thing to download.
* @param downloadDir: The download directory where the thing should be stored (takes precedence over any "dir" in `options`).
* @param options: A series of pair <option_name, option_value> to pass to aria.
* @return: The newly created Download.
*/
std::shared_ptr<Download> startDownload(const std::string& uri, const std::string& downloadDir, Options options = {});
std::shared_ptr<Download> startDownload(const std::string& uri, const Options& options = {});
/**
* Get a download corrsponding to a download id (did)

View File

@ -45,6 +45,32 @@ typedef std::vector<std::string> FeedCategories;
*/
std::string getCurrentDirectory();
/**
* Return the data directory
*
* The data directory is the default directory where downloaded files
* should be saved (it can be overriden via the options parameter of
* `kiwix::Downloader::startDownload()`).
*
* Its path can vary and is determined as follows:
*
* * `$KIWIX_DATA_DIR` if `$KIWIX_DATA_DIR` environment variable set, *otherwise...*
* * On Windows:
*
* * `$APPDATA/kiwix` if environment variable `$APPDATA` set, *otherwise...*
* * `$USERPROFILE/kiwix` if environment variable `$USERPROFILE` set, *otherwise...*
*
* * On other Operating Systems:
*
* * `$XDG_DATA_HOME/kiwix` if environment variable `$XDG_DATA_HOME` set, *otherwise...*
* * `$HOME/.local/share/kiwx` if environment variable `$HOME` set, *otherwise...*
*
* * Current working directory.
*
* @return the path of the data directory (UTF-8 encoded)
*/
std::string getDataDirectory();
/** Return the path of the executable
*
* Some application may be packaged in auto extractible archive (Appimage) and the