Skip to content

Cross-Platform Path Separator Inconsistencies via path Package#477

Open
aniket866 wants to merge 1 commit into
microcks:masterfrom
aniket866:fix/Cross-Platform-Path
Open

Cross-Platform Path Separator Inconsistencies via path Package#477
aniket866 wants to merge 1 commit into
microcks:masterfrom
aniket866:fix/Cross-Platform-Path

Conversation

@aniket866

@aniket866 aniket866 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

ISSUE

In pkg/config/localconfig.go, configuration directory pathing and creation utilities use the path package instead of path/filepath. The Go standard library path package 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

  • pkg/config/localconfig.go

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"]
Loading

Steps to Reproduce

  1. Execute any command that reads or writes config on Windows (e.g., microcks login).
  2. The config directory is created/resolved in a non-native path format with mixed slashes.

Closes #476

Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
@Vaishnav88sk

Copy link
Copy Markdown

Good catch. path/filepath is the right choice for OS-level paths. Please also add a test covering Windows-style home dirs if possible.

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.

Cross-Platform Path Separator Inconsistencies via path Package

2 participants