Cross-Platform Path Separator Inconsistencies via path Package - #477
Cross-Platform Path Separator Inconsistencies via path Package#477aniket866 wants to merge 4 commits into
path Package#477Conversation
Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
|
Good catch. |
…to fix/Cross-Platform-Path
Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
|
hi @Vaishnav88sk I have done the requested changes , Please review |
|
This overlaps with #442, so we should not merge both. |
|
Also, the added test does not really verify Windows-style separator behavior yet. Because it builds the “Windows” home path using So I’d like the test adjusted to assert a real backslash-style home path, or otherwise be made explicitly Windows-targeted. |
|
ALso add copyright block to the test file. |
Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
|
Thank you @aniket866 This has been fixed by #442 — pkg/config/localconfig.go now uses path/filepath (filepath.Join) for all config path construction, so Windows paths come out native. I believe this can be closed. |
ISSUE
In
pkg/config/localconfig.go, configuration directory pathing and creation utilities use thepathpackage instead ofpath/filepath. The Go standard librarypathpackage is strictly designed for forward-slash URL paths and does not handle Windows backslashes (\).Impact
On Windows systems, paths are constructed in a mixed format (e.g.
C:\Users\Name/.config/microcks/config), which causes file system APIs and permissions logic to fail or look in wrong locations.Code Reference
Issue visualization
graph TD A["getHomeDir() on Windows -> 'C:\\Users\\Name'"] --> B["path.Join(homeDir, '.config', 'microcks')"] B --> C["Result: 'C:\\Users\\Name/.config/microcks'"] C --> D["os.MkdirAll() creates folders with mixed slashes, breaking standard Windows paths"]Steps to Reproduce
microcks login).Closes #476