KVIrc 5.2.6
Developer APIs
KviFileUtils.h File Reference

File utilities functions. More...

#include "kvi_settings.h"
#include <QFile>
#include <QStringList>

Go to the source code of this file.

Namespaces

namespace  KviFileUtils
 A namespace to handle file utilities functions.
 

Macros

#define KVI_PATH_SEPARATOR   "/"
 
#define KVI_PATH_SEPARATOR_CHAR   '/'
 

Functions

void KviFileUtils::adjustFilePath (QString &szPath)
 Adjusts the file path to the current platform.
 
void KviFileUtils::cleanFileName (QString &szPath)
 Removes any unusable character from a filename (with no path!)
 
bool KviFileUtils::copyFile (const char *pcSrc, const char *pcDst)
 Copy the file (cp -f)
 
bool KviFileUtils::copyFile (const QString &szSrc, const QString &szDst)
 Copy the file (cp -f)
 
bool KviFileUtils::deleteDir (const QString &szPath)
 Removes a dir recursively.
 
bool KviFileUtils::directoryExists (const QString &szPath)
 Returns true if szPath points to an existing directory.
 
void KviFileUtils::encodeFileName (QString &szPath)
 Translates ANY string into a valid filename (with no path!)
 
QString KviFileUtils::extractFileName (const QString &szFileNameWithPath, bool bAllowEmpty=true)
 Extracts the filename from a complete path (strips leading path)
 
QString KviFileUtils::extractFilePath (const QString &szFileNameWithPath)
 Extracts the filename from a complete path (strips leading path)
 
bool KviFileUtils::fileExists (const QString &szPath)
 Returns true if szPath points to an existing file.
 
QStringList KviFileUtils::getFileListing (const QString &szPath)
 
bool KviFileUtils::isAbsolutePath (const QString &szPath)
 Returns true if the path is absolute, false otherwise.
 
bool KviFileUtils::isReadable (const QString &szFname)
 Returns true if the file is readable, false otherwise.
 
bool KviFileUtils::loadFile (const QString &szPath, QString &szBuffer, bool bUtf8=true)
 Loads the file at szPath to szBuffer eventually converting from UTF-8.
 
bool KviFileUtils::makeDir (const char *pcPath)
 Create a directory (mkdir)
 
bool KviFileUtils::makeDir (const QString &szPath)
 Create a directory (mkdir)
 
bool KviFileUtils::readFile (const char *pcPath, QString &szBuffer, unsigned int uMaxSize=65535)
 Reads a complete file and puts it in the string szBuffer.
 
bool KviFileUtils::readFile (const QString &szPath, QString &szBuffer, unsigned int uMaxSize=65535)
 Reads a complete file and puts it in the string szBuffer.
 
bool KviFileUtils::readLine (QFile *pFile, QString &szBuffer, bool bUtf8=true)
 Reads a text line, returns false if EOF is reached.
 
bool KviFileUtils::readLines (QFile *pFile, QStringList &buffer, int iStartLine=0, int iCount=-1, bool bUtf8=true)
 Reads text lines, returns false if EOF is reached.
 
bool KviFileUtils::removeDir (const char *pcPath)
 Removes a dir (must be empty)
 
bool KviFileUtils::removeDir (const QString &szPath)
 Removes a dir (must be empty)
 
bool KviFileUtils::removeFile (const char *pcPath)
 Removes a file.
 
bool KviFileUtils::removeFile (const QString &szPath)
 Removes a file.
 
bool KviFileUtils::renameFile (const char *pcSrc, const char *pcDst)
 Rename or move the file (mv)
 
bool KviFileUtils::renameFile (const QString &szSrc, const QString &szDst)
 Rename or move the file (mv)
 
bool KviFileUtils::writeFile (const char *pcPath, const QString &szData, bool bAppend=false)
 Writes a complete file (UTF-8 version)
 
bool KviFileUtils::writeFile (const QString &szPath, const QByteArray &oData, bool bAppend=false)
 Writes a complete file (UTF-8 version)
 
bool KviFileUtils::writeFile (const QString &szPath, const QString &szData, bool bAppend=false)
 Writes a complete file (UTF-8 version)
 
bool KviFileUtils::writeFileLocal8Bit (const char *pcPath, const QString &szData, bool bAppend=false)
 Writes a complete file (local 8 bit version)
 
bool KviFileUtils::writeFileLocal8Bit (const QString &szPath, const QString &szData, bool bAppend=false)
 Writes a complete file (local 8 bit version)
 

Detailed Description

File utilities functions.

Author
Szymon Stefanek

Macro Definition Documentation

◆ KVI_PATH_SEPARATOR

◆ KVI_PATH_SEPARATOR_CHAR

#define KVI_PATH_SEPARATOR_CHAR   '/'

Referenced by SetupWizard::accept(), KviPackageWriter::addDirectory(), addon_kvs_cmd_installfiles(), SetupWizard::chooseDataPath(), OptionsWidget_textIcons::chooseFromFile(), SetupWizard::chooseOldDataPath(), DccBroker::chooseSaveFileName(), KviApplication::completeDirectory(), KviModuleManager::completeModuleNames(), LogFile::createLog(), LogViewWindow::exportLog(), file_kvs_fnc_cwd(), file_kvs_fnc_extractfilename(), file_kvs_fnc_globaldir(), file_kvs_fnc_homedir(), file_kvs_fnc_localdir(), file_kvs_fnc_ps(), file_kvs_fnc_rootdir(), KviApplication::findAudioFile(), KviLocale::findCatalogue(), KviApplication::findImage(), KviApplication::findImageInImageSearchPath(), KviApplication::findImageThemeOnlyCompat(), KviApplication::findLocalKvircDirectory(), KviApplication::findSmallIcon(), KviWindow::getDefaultLogFileName(), KviApplication::getGlobalKvircDirectory(), KviApplication::getLocalKvircDirectory(), KviApplication::getTmpFileName(), PackAddonSaveSelectionWidget::initializePage(), AddonFunctions::installAddonPackage(), KviKvsCoreSimpleCommands::KVSCSC(), KviModuleManager::loadModulesByCaps(), LogFile::LogFile(), logview_module_ctrl(), KviFileUtils::makeDir(), SetupWizard::makeLink(), KviApplication::mapImageFile(), PackAddonDialog::packAddon(), package_kvs_fnc_info(), PackThemeDataWidget::parseThemes(), KviTheme::save(), KviThemeInfo::setDirectoryAndLocation(), KviApplication::setupBegin(), SetupWizard::SetupWizard(), ExportOperation::start(), KviPackageReader::unpackFile(), and WebThemeInterfaceDialog::WebThemeInterfaceDialog().