Skip to content

Commit

Permalink
folderutils.cpp: Fix getAppPartsSubFolder2 returns current working di…
Browse files Browse the repository at this point in the history
…rectory if fritzing-parts folder is not found

getApplicationSubFolder returns QDir() if the directory can not be found,
but QDir() returns the current working directory, which nearly always exists and probably is the wrong path.
As getAppPartsSubFolder2 only checks for existence of that directory we end up with the wrong directory if parts folder is used instead for fritzing-parts.
Therefore check if when we ask for fritzing-parts folder we really get a folder with that name.
  • Loading branch information
heinervdm authored and KjellMorgenstern committed Nov 24, 2019
1 parent b72de1e commit e783232
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/folderutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ QDir FolderUtils::getAppPartsSubFolder(QString search) {
QDir FolderUtils::getAppPartsSubFolder2(QString search) {
if (m_partsPath.isEmpty()) {
QDir dir = getApplicationSubFolder("fritzing-parts");
if (dir.exists()) {
if (dir.exists() && dir.dirName().endsWith("fritzing-parts")) {
m_partsPath = dir.absolutePath();
}
else {
QDir dir = getApplicationSubFolder("parts");
if (dir.exists()) {
if (dir.exists() && dir.dirName().endsWith("parts")) {
m_partsPath = dir.absolutePath();
}
}
Expand Down

0 comments on commit e783232

Please sign in to comment.