MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / validateImportFile

Method validateImportFile

src/core/ProfileTransfer.cpp:336–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334}
335
336bool ProfileTransfer::validateImportFile(const QString& path, QString* error) const
337{
338 const QFileInfo info(path);
339 if (!info.exists() || !info.isFile()) {
340 *error = QStringLiteral("Choose a readable .ssdr_cfg package to import.");
341 return false;
342 }
343 if (info.suffix().compare(QStringLiteral("ssdr_cfg"), Qt::CaseInsensitive) != 0) {
344 *error = QStringLiteral("Only SmartSDR .ssdr_cfg packages can be imported.");
345 return false;
346 }
347 if (info.size() <= 0) {
348 *error = QStringLiteral("The selected .ssdr_cfg package is empty.");
349 return false;
350 }
351 if (info.size() > kMaxImportSize) {
352 *error = QStringLiteral("The selected .ssdr_cfg package is larger than the safety limit.");
353 return false;
354 }
355 QFile file(path);
356 if (!file.open(QIODevice::ReadOnly)) {
357 *error = QStringLiteral("Cannot read the import package: %1").arg(file.errorString());
358 return false;
359 }
360 return true;
361}
362
363void ProfileTransfer::requestUploadPort(const QByteArray& payload, const QString& uploadKind)
364{

Callers

nothing calls this directly

Calls 3

isFileMethod · 0.80
sizeMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected