feat(cpn): Clean up B&W MODELS folder before write to radio (#1932)
This commit is contained in:
@@ -61,7 +61,7 @@ bool SdcardFormat::getFileList(std::list<std::string>& filelist)
|
||||
{
|
||||
QDir dir(filename);
|
||||
if (!dir.cd("MODELS")) return false;
|
||||
|
||||
|
||||
QStringList ql = dir.entryList();
|
||||
for (const auto& str : ql) {
|
||||
filelist.push_back("MODELS/" + str.toStdString());
|
||||
@@ -69,6 +69,19 @@ bool SdcardFormat::getFileList(std::list<std::string>& filelist)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SdcardFormat::deleteFile(const QString & filename)
|
||||
{
|
||||
QString path = this->filename + "/" + filename;
|
||||
|
||||
if (!QFile::remove(path)) {
|
||||
setError(tr("Error deleting file %1").arg(path));
|
||||
return false;
|
||||
}
|
||||
|
||||
qDebug() << "File" << path << "deleted";
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SdcardStorageFactory::probe(const QString & path)
|
||||
{
|
||||
return QDir(path).exists();
|
||||
|
||||
Reference in New Issue
Block a user