mirror of
https://gitlab.com/comunic/comunicmessages
synced 2025-06-20 00:45:17 +00:00
Can load remote images and cache them locally.
This commit is contained in:
19
utils/filesutils.cpp
Normal file
19
utils/filesutils.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include <QDir>
|
||||
|
||||
#include "filesutils.h"
|
||||
|
||||
FilesUtils::FilesUtils()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool FilesUtils::CreateDirectoryIfNotExists(const QString &path)
|
||||
{
|
||||
QDir dir(path);
|
||||
|
||||
//Check if the directory already exists
|
||||
if(dir.exists())
|
||||
return true;
|
||||
|
||||
return dir.mkpath(".");
|
||||
}
|
28
utils/filesutils.h
Normal file
28
utils/filesutils.h
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Files utilities
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
#ifndef FILESUTILS_H
|
||||
#define FILESUTILS_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
class FilesUtils
|
||||
{
|
||||
public:
|
||||
FilesUtils();
|
||||
|
||||
/**
|
||||
* Create the specified directory and all its parents if they do not
|
||||
* exists
|
||||
*
|
||||
* @param path The path of the folder to check
|
||||
* @return TRUE if the folder exists or has been successfully created /
|
||||
* FALSE else
|
||||
*/
|
||||
static bool CreateDirectoryIfNotExists(const QString &path);
|
||||
};
|
||||
|
||||
#endif // FILESUTILS_H
|
Reference in New Issue
Block a user