fix: resolve configurations path from executable location#72
Closed
mauricio-leoncio wants to merge 1 commit intocmd-tools:mainfrom
Closed
fix: resolve configurations path from executable location#72mauricio-leoncio wants to merge 1 commit intocmd-tools:mainfrom
mauricio-leoncio wants to merge 1 commit intocmd-tools:mainfrom
Conversation
4 tasks
Collaborator
|
closed as done in #74 |
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.
Fix: Resolve configurations path from executable location
Problem
When
aws-commanderis installed via Homebrew (brew install aws-commander), running the binary from any directory other than the project root fails with:This happens because
ConfigurationsRelativeFilePathwas hardcoded as"./configurations", which resolves against the current working directory instead of the binary's location.Solution
Replaced the hardcoded relative path with
resolveConfigurationsPath(), which usesos.Executable()+filepath.EvalSymlinks()to locate theconfigurations/directory next to the actual binary. This handles both direct execution and Homebrew's symlink layout (bin/→Cellar/). Falls back to"./configurations"if resolution fails.Local Testing (Run from the aws-commander folder to build it)
1. Reproduce the bug:
2. Apply fix and test with configurations next to binary:
3. Test symlink scenario (simulates Homebrew layout):
4. Verify existing tests: