Repository navigation
fix(install): set MATLAB's userpath when nansen_install asks for one - #201
Merged
Merged
Conversation
nansen_install asks for a folder when userpath is empty, but the userpath call in resolveEmptyUserpath was commented out while the message still reported an update. getDefaultAddonFolder then threw NANSEN:Addons:EmptyUserpath, so the installation could not continue. Set the userpath from the entered folder and read it back before reporting success, since MATLAB only warns when it can not add the folder to the search path. Reject a relative path before anything is created. In batch mode, where input throws, stop with an error that says what to run. Move everything but the prompts to setUserpathFromFolder so that it can be tested without keyboard input. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
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.
When
userpath()is empty and noAddonFolderis given,nansen_installcallsnansen.internal.setup.resolveEmptyUserpath. That function asked for a folder and printed "Updated MATLAB's userpath to ...", but itsuserpath(userPathDirectory)line was commented out, and has been since the file was added in 531831b.nansen.config.addons.getDefaultAddonFolderthen threwNANSEN:Addons:EmptyUserpath, so the prompt could not lead to an installation.The commit that added the file gives no reason for commenting the line out.
Changes:
resolveEmptyUserpathkeeps the twoinputprompts and passes the answer to the newnansen.internal.setup.setUserpathFromFolder.setUserpathFromFoldercreates<entered>/MATLAB/Nansenafter confirmation and callsuserpath(<entered>/MATLAB). MATLAB adds that folder to the search path and keeps the value for later sessions. The prompt now says so.userpath()back before printing success, becauseuserpath(newpath)leaves the value unchanged and only warns whenaddpathcan not add the folder. An empty read-back throwsNANSEN:Setup:UserpathNotSet.NANSEN:Setup:UserpathFolderNotAbsolutebefore any folder is created.userpath(newpath)rejects a relative path in R2024b.inputthrowsMATLAB:services:MissingRequiredCapabilityunder-batch, so in batch moderesolveEmptyUserpaththrowsNANSEN:Setup:EmptyUserpathInBatchMode, which says to runuserpath("<full path of an existing folder>")and thennansen_installagain.tests/+nansen/+unittest/+setup/EmptyUserpathTest.mcovers these paths. It generates a stub ofuserpathon a temporary path entry, so no test changes the saved setting, and the stub requires the folder to exist when it is set, as the real function does.🤖 Generated with Claude Code