Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is that ok to ignore the workplace case sensitive on macOS #1133

Closed
ccqpein opened this issue Feb 21, 2024 · 2 comments
Closed

Is that ok to ignore the workplace case sensitive on macOS #1133

ccqpein opened this issue Feb 21, 2024 · 2 comments

Comments

@ccqpein
Copy link

ccqpein commented Feb 21, 2024

I find in macOS, path is actually case insensitive.

And I find exercism submit actually check the case sensitive on macOS.

cli/workspace/workspace.go

Lines 124 to 131 in 8f1e8f2

if !strings.HasPrefix(s, ws.Dir) {
var err = fmt.Errorf("not in workspace")
if runtime.GOOS == "darwin" {
err = fmt.Errorf("%w: directory location may be case sensitive: workspace directory: %s, "+
"submit path: %s", err, ws.Dir, s)
}
return "", err
}

Can we ignore this case sensitive and just submit?

Copy link

Hello. Thanks for opening an issue on Exercism 🙂

At Exercism we use our Community Forum, not GitHub issues, as the primary place for discussion. That allows maintainers and contributors from across Exercism's ecosystem to discuss your problems/ideas/suggestions without them having to subscribe to hundreds of repositories.

This issue will be automatically closed. Please use this link to copy your GitHub Issue into a new topic on the forum, where we look forward to chatting with you!

If you're interested in learning more about this auto-responder, please read this blog post.

@ccqpein
Copy link
Author

ccqpein commented Feb 21, 2024

I make the change in my local

modified   workspace/workspace.go
@@ -123,11 +123,11 @@ func (ws Workspace) Exercises() ([]Exercise, error) {
 func (ws Workspace) ExerciseDir(s string) (string, error) {
 	if !strings.HasPrefix(s, ws.Dir) {
 		var err = fmt.Errorf("not in workspace")
-		if runtime.GOOS == "darwin" {
-			err = fmt.Errorf("%w: directory location may be case sensitive: workspace directory: %s, "+
-				"submit path: %s", err, ws.Dir, s)
+		if runtime.GOOS != "darwin" {
+			return "", err
+		} else if !strings.HasPrefix(strings.ToLower(s), strings.ToLower(ws.Dir)) {
+			return "", err
 		}
-		return "", err
 	}
 
 	path := s

And looks like it can handle both upper/lower case when I try to submit. (and the unit test failed ofc)

I am not sure if anywhere else use this method (I only find it referenced in cmd/submit.go.

If you guys think this change is making sense, I can give a PR to make this change.

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

No branches or pull requests

1 participant