Program Listing for File tools.h¶
↰ Return to documentation for file (include/tools.h
)
/*
* Copyright 2021 Matthieu Gautier <mgautier@kymeria.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef KIWIX_TOOLS_H
#define KIWIX_TOOLS_H
#include <string>
#include <vector>
#include <map>
namespace kiwix {
std::string getCurrentDirectory();
std::string getDataDirectory();
std::string getExecutablePath(bool realPathOnly = false);
bool isRelativePath(const std::string& path);
std::string appendToDirectory(const std::string& basePath, const std::string& relativePath);
std::string removeLastPathElement(const std::string& path);
std::string getLastPathElement(const std::string& path);
std::string computeAbsolutePath(const std::string& path, const std::string& relativePath);
std::string computeRelativePath(const std::string& path, const std::string& absolutePath);
void sleep(unsigned int milliseconds);
std::vector<std::string> split(const std::string& str, const std::string& delims, bool dropEmpty=true, bool keepDelim = false);
std::string converta2toa3(const std::string& a2code);
std::string getFileContent(const std::string& path);
bool fileExists(const std::string& path);
bool fileReadable(const std::string& path);
std::string getMimeTypeForFile(const std::string& filename);
std::map<std::string, std::string> getNetworkInterfaces();
std::string getBestPublicIp();
}
#endif // KIWIX_TOOLS_H