Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

folderutils.cpp: Fix getAppPartsSubFolder2 returns current working di… #3311

Merged
merged 1 commit into from
Nov 24, 2019

Conversation

heinervdm
Copy link
Contributor

…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.

@cjmayo
Copy link
Contributor

cjmayo commented Feb 4, 2017

Is it possible instead to put these tests inside getApplicationSubFolder()? And for it not to return the home directory?

@heinervdm
Copy link
Contributor Author

I would find this nicer too and tried to implement it that way, but the result of getApplicationSubFolder is only checked in getAppPartsSubFolder2 and not in the other places it is used. So returning an non existing folder can cause problems in these cases. Also I found no clear way to indicate an error in the return value, when returning the QDir by value.

@madpipeline madpipeline changed the base branch from master to develop April 30, 2019 17:25
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants