Commit 629330c6056bb14774a962de37526e5f59325c4f
1 parent
66cb21a5
Committing change to init function in AlgorithmCore which changes the default in…
…put to QStrings instead of Files to remove issues parenthessis and other issues removed unused line of code made changes as requested to clean up code removed temp variable switched back to use temp variable removing brackets
Showing
1 changed file
with
7 additions
and
5 deletions
openbr/core/core.cpp
| ... | ... | @@ -516,17 +516,19 @@ private: |
| 516 | 516 | QString getFileName(const QString &description) const |
| 517 | 517 | { |
| 518 | 518 | const QString file = Globals->sdkPath + "/share/openbr/models/algorithms/" + description; |
| 519 | - return QFileInfo(file).exists() ? file : QString(); | |
| 519 | + QFileInfo qFile(file); | |
| 520 | + return qFile.exists() && !qFile.isDir() ? file : QString(); | |
| 520 | 521 | } |
| 521 | 522 | |
| 522 | - void init(const File &description) | |
| 523 | + void init(const QString &description) | |
| 523 | 524 | { |
| 524 | 525 | // Check if a trained binary already exists for this algorithm |
| 525 | 526 | const QString file = getFileName(description); |
| 526 | 527 | if (!file.isEmpty()) return init(file); |
| 527 | 528 | |
| 528 | - if (description.exists()) { | |
| 529 | - qDebug("Loading %s", qPrintable(description.fileName())); | |
| 529 | + QFileInfo dFile(description); | |
| 530 | + if (dFile.exists()) { | |
| 531 | + qDebug("Loading %s", qPrintable(dFile.fileName())); | |
| 530 | 532 | load(description); |
| 531 | 533 | return; |
| 532 | 534 | } |
| ... | ... | @@ -536,7 +538,7 @@ private: |
| 536 | 538 | return init(Globals->abbreviations[description]); |
| 537 | 539 | |
| 538 | 540 | //! [Parsing the algorithm description] |
| 539 | - QStringList words = QtUtils::parse(description.flat(), ':'); | |
| 541 | + QStringList words = QtUtils::parse(description, ':'); | |
| 540 | 542 | if ((words.size() < 1) || (words.size() > 2)) qFatal("Invalid algorithm format."); |
| 541 | 543 | //! [Parsing the algorithm description] |
| 542 | 544 | ... | ... |