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

Fix FixPath #2461

Merged
merged 1 commit into from
Jan 3, 2022
Merged

Conversation

slaff
Copy link
Contributor

@slaff slaff commented Dec 31, 2021

Translates "" into "/" which is not only wrong but can do weird things in Windows.

Let's just check various path permutations to make sure they're handled correctly.
Test script:

define Check
$(info FixPath "$1": "$(call FixPath,$1)")
endef

$(call Check,)
$(call Check,C:\test)
$(call Check,test)
$(call Check,./test)
$(call Check,/c/test)
$(call Check,c:/test)
$(call Check,c:/path with spaces)

Run from Basic_Blink sample directory, we previously get this:

FixPath "": "/"
FixPath "C:\test": "/C/test"
FixPath "test": "/test"
FixPath "./test": "/./test"
FixPath "/c/test": "/c/test"
FixPath "c:/test": "/c/test"
FixPath "c:/path with spaces": "/c/path with spaces"

With this commit:

FixPath "": ""
FixPath "C:\test": "/C/test"
FixPath "test": "/s/sandboxes/sming-tmp/samples/Basic_Blink/test"
FixPath "./test": "/s/sandboxes/sming-tmp/samples/Basic_Blink/test"
FixPath "/c/test": "/c/test"
FixPath "c:/test": "/c/test"
FixPath "c:/path with spaces": "/c/path with spaces"

Backported from #2459

Co-authored-by: Mike mike@sillyhouse.net

…s in Windows.

Let's just check various path permutations to make sure they're handled correctly.
Test script:

```
define Check
$(info FixPath "$1": "$(call FixPath,$1)")
endef

$(call Check,)
$(call Check,C:\test)
$(call Check,test)
$(call Check,./test)
$(call Check,/c/test)
$(call Check,c:/test)
$(call Check,c:/path with spaces)
```

Run from `Basic_Blink` sample directory, we previously get this:

```
FixPath "": "/"
FixPath "C:\test": "/C/test"
FixPath "test": "/test"
FixPath "./test": "/./test"
FixPath "/c/test": "/c/test"
FixPath "c:/test": "/c/test"
FixPath "c:/path with spaces": "/c/path with spaces"
```

With this commit:

```
FixPath "": ""
FixPath "C:\test": "/C/test"
FixPath "test": "/s/sandboxes/sming-tmp/samples/Basic_Blink/test"
FixPath "./test": "/s/sandboxes/sming-tmp/samples/Basic_Blink/test"
FixPath "/c/test": "/c/test"
FixPath "c:/test": "/c/test"
FixPath "c:/path with spaces": "/c/path with spaces"
```

Co-authored-by: Mike <mike@sillyhouse.net>
@slaff slaff added this to the 4.2.x - LTS milestone Dec 31, 2021
@mikee47 mikee47 changed the title Translates "" into "/" which is not only wrong but can do weird thing… Fix FixPath Dec 31, 2021
@slaff slaff merged commit 4e94423 into SmingHub:lts-develop/4.2.x Jan 3, 2022
@slaff slaff deleted the lts-develop/4.2.x-fix-path branch January 19, 2022 14:30
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.

2 participants