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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed path to start external tools, added QucsApp::launchTool() function #175

Merged
merged 1 commit into from Jan 15, 2015

Conversation

in3otd
Copy link
Contributor

@in3otd in3otd commented Jan 11, 2015

I had installed Qucs in a local directory, in parallel with the main system-wide install, and noticed that the external tools launched (qucsfilter, qucstrans, etc.) were always the ones from the system wide installation.
Looking at the code I think there is a copy-and-paste error, in that almost all the tools were launched with code like

QucsFilter->setWorkingDirectory(QucsSettings.BinDir);
QucsFilter->start(prog);
prog = QDir::toNativeSeparators(QucsSettings.BinDir+prog);
qDebug() << "Command :" << prog;

so the actual tool launched was the one in the environment path, but the debug message printed contained the right path !!
I took the opportunity to clean up this part of the code, eliminating the copy/paste and adding a new launchTool() function.
Note that the code could probably be simplified even more, also in qucs_init.cpp, by having a Tool class handling the available external tools registration, where each registered tool will provide its executable name and its description to use in menus and messages, so the Tools menu built starting at https://github.com/Qucs/qucs/blob/master/qucs/qucs/qucs_init.cpp#L525 and https://github.com/Qucs/qucs/blob/master/qucs/qucs/qucs_init.cpp#L766 could "just" be built iterating over the available tools... but honestly it's still not clear to me if and how this could be done, so for the moment I am stopping here 馃槈

Edit: just fixed syntax error in #elif APPLE part of last modification.

@yodalee
Copy link
Contributor

yodalee commented Jan 14, 2015

It seems launchTool with two QString arguments are calling launchTool with three QString and leaving the third argument an empty string.
Can you change it to only launchTool with three QString and using default argument, something like:

launchTool(QString &, QString &, QString & = QString())

@in3otd
Copy link
Contributor Author

in3otd commented Jan 14, 2015

oops! ...I am more of a C programmer... Fixed now.

Before this all the external tools were launched by similar copy-pasted code,
with some bugs added... now all the code for launching the external tools is
in the launchTool() function to have a more compact code and remove the
possibility of copy-paste errors next time an external tool wil be added.
yodalee added a commit that referenced this pull request Jan 15, 2015
Fixed path to start external tools, added QucsApp::launchTool() function
@yodalee yodalee merged commit 0fbca1e into Qucs:master Jan 15, 2015
@yodalee
Copy link
Contributor

yodalee commented Jan 15, 2015

Merged

@in3otd in3otd deleted the tools_launch branch January 17, 2015 08:28
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.

None yet

2 participants