MCPcopy Create free account
hub / github.com/Audio4Linux/JDSP4Linux / CheckFile

Function CheckFile

3rdparty/qtcsv/sources/filechecker.h:15–34  ·  view source on GitHub ↗

Check if path to csv file is valid @input: - filePath - string with absolute path to file - mustExist - True if file must exist, False if this is not important @output: - bool - True if file is OK, else False

Source from the content-addressed store, hash-verified

13 // @output:
14 // - bool - True if file is OK, else False
15 inline bool CheckFile(const QString& filePath, const bool mustExist = false)
16 {
17 if (filePath.isEmpty()) {
18 qDebug() << __FUNCTION__ << "Error - file path is empty";
19 return false;
20 }
21
22 QFileInfo fileInfo(filePath);
23 if (fileInfo.isAbsolute() && false == fileInfo.isDir()) {
24 if (mustExist && false == fileInfo.exists()) { return false; }
25 if ("csv" != fileInfo.suffix()) {
26 qDebug() << __FUNCTION__ <<
27 "Warning - file suffix is not .csv";
28 }
29
30 return true;
31 }
32
33 return false;
34 }
35}
36
37#endif // QTCSVFILECHECKER_H

Callers 2

writeMethod · 0.70
openFileFunction · 0.70

Calls 2

isEmptyMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected