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

Fixing issue with -debug on windows #31

Merged
merged 2 commits into from Dec 19, 2018
Merged

Conversation

WhoBrokeTheBuild
Copy link
Contributor

@WhoBrokeTheBuild WhoBrokeTheBuild commented Dec 18, 2018

Added backslash cleaning for windows.
Without it, debug functions would be erroneously generated with single backslashes, causing go syntax errors.
Before:

func bindataDatafontsdefaultttf() (*asset, error) {
	path := "C:\Repos\GoDusk\dusk/data\fonts\default.ttf"

After:

func bindataDatafontsdefaultttf() (*asset, error) {
	path := "C:/Repos/GoDusk/dusk/data/fonts/default.ttf"

@shuLhan
Copy link
Owner

shuLhan commented Dec 18, 2018

Added backslash cleaning for windows.
Without it, debug functions would be erroneously generated with single backslashes, causing go syntax errors.
Before:

func bindataDatafontsdefaultttf() (*asset, error) {
	path := "C:\Repos\GoDusk\dusk/data\fonts\default.ttf"

After:

func bindataDatafontsdefaultttf() (*asset, error) {
	path := "C:/Repos/GoDusk/dusk/data/fonts/default.ttf"

Thanks for the patch.

I am sorry, its long time that I didn't play with Windows. Does Windows accept slash as directory separator now?

@WhoBrokeTheBuild
Copy link
Contributor Author

It does yes, we could also make it print an escaped \ but I think all forward slashes is better.
Thanks for hosting the fork!

@WhoBrokeTheBuild
Copy link
Contributor Author

We could also use fmt's %q:

%q	a double-quoted string safely escaped with Go syntax

@shuLhan
Copy link
Owner

shuLhan commented Dec 18, 2018

It does yes, we could also make it print an escaped \ but I think all forward slashes is better.

What if we use filepath.Join instead of strings.Replace? Will it solve the problem on both *Nix and Windows?

Thanks for hosting the fork!

No, Github hosting it ;) , I am just scratching my own itch, just like yours, continuing previous works.

@WhoBrokeTheBuild
Copy link
Contributor Author

Haha!
filepath.Join would work too, but it still outputs using the OS-native file separator, which on windows will be \, and will still cause us grief.
If we use a combination of filepath.Clean() and %q, I think it would work out well, lemme update the PR

@shuLhan shuLhan merged commit a94a45d into shuLhan:master Dec 19, 2018
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.

None yet

2 participants