fix(amuleweb): honor per-user template dir when spawned by the GUI - #72
Merged
Merged
Conversation
In --amule-config-file mode (the mode aMule and aMuled use to spawn amuleweb automatically), CamulewebApp::OnCmdLineParsed returns early and never reaches CaMuleExternalConnector::OnCmdLineParsed, which is where m_configDir is normally initialized. With m_configDir empty, GetTemplateDir looked for "webserver" relative to the current working directory, so the per-user template directory (<config>/webserver/) was silently skipped and the lookup always fell through to the system-wide WEBSERVERDIR (/usr/share/amule/webserver/). Derive m_configDir from the directory of the amule.conf file passed on the command line, so a GUI-spawned amuleweb resolves templates from the same config dir as the daemon that launched it. This also fixes the webserver locale lookup, which builds its path from m_configDir as well. Verified by launching the rebuilt amuleweb with --amule-config-file=~/.aMule/amule.conf and confirming it now serves templates from ~/.aMule/webserver/default/ instead of the installed copy.
|
Nice catch, thanks @ngosang. Traced the early-return path and the locale lookup at WebInterface.cpp:555 — same |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In --amule-config-file mode (the mode aMule and aMuled use to spawn amuleweb automatically), CamulewebApp::OnCmdLineParsed returns early and never reaches CaMuleExternalConnector::OnCmdLineParsed, which is where m_configDir is normally initialized. With m_configDir empty, GetTemplateDir looked for "webserver" relative to the current working directory, so the per-user template directory (/webserver/) was silently skipped and the lookup always fell through to the system-wide WEBSERVERDIR (/usr/share/amule/webserver/).
Derive m_configDir from the directory of the amule.conf file passed on the command line, so a GUI-spawned amuleweb resolves templates from the same config dir as the daemon that launched it. This also fixes the webserver locale lookup, which builds its path from m_configDir as well.
Verified by launching the rebuilt amuleweb with
--amule-config-file=~/.aMule/amule.conf and confirming it now serves templates from ~/.aMule/webserver/default/ instead of the installed copy.