-
Notifications
You must be signed in to change notification settings - Fork 1
/
filecheck.cpp
48 lines (34 loc) · 869 Bytes
/
filecheck.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "filecheck.h"
FileCheck::FileCheck()
{
}
bool FileCheck::sl_exist(QString file_url)
{
if(file_url.contains("file://"))
file_url.remove("file://");
QFile obj_file(file_url);
return obj_file.exists();
}
QString FileCheck::sl_Read(QString file_url)
{
if(file_url.contains("file://"))
file_url.remove("file://");
QFile obj_file(file_url);
obj_file.open(QIODevice::ReadOnly);
return QString::fromStdString(obj_file.readAll().toStdString());
}
int FileCheck::sl_Size(QString file_url)
{
if(file_url.contains("file://"))
file_url.remove("file://");
int size = 0;
QFile obj_file(file_url);
if(obj_file.open(QIODevice::ReadOnly))
{
QByteArray data = obj_file.readAll();
size = data.size();
}
else
qDebug() <<obj_file.errorString();
return size;
}