go-bindata
go-bindata copied to clipboard
escaping the \ character in the file path
On Windows the file paths are normally \ and not / and when you include a directory it generates code that will not build.
My example: go-bindata -ignore=\*.bak -o assets.go scripts\
in my assets.go file I end up with scripts\file name and that throws an error due to the unescaped
in release.go the offending line is
info := bindataFileInfo{name: %q, size: %d, mode: os.FileMode(%d), modTime: time.Unix(%d, 0)}
I'm assuming that %q needs to be sanitized.
@SQLServerIO ,
Since I don't have Windows machine to test the output, I try to blind fix this on branch dev-shulhan
. Can you give it a try?
Forward slash is working in Windows as well. Must not be a problem since Windows Vista
@shuLhan You can grab a windows VM from Microsoft at https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/. They're intended for browser testing, but I've not seen any restrictions on installing other software.
Windows has supported both slashes as path separators for a very long time (back in the early DOS days). The dev branch worked for me with the exception that it required a directory component for the output file: https://github.com/shuLhan/go-bindata/blob/4ec947ecc450dcdbe00746e8477d15216fb37732/config.go#L226-L231
It looks like this might be part of a new mechanism for handling the output, but it breaks the existing scenario where the output is defined to be a single file.
@SQLServerIO,
I have installed Windows in virtual machine just to test and try to fix this bug but I can't reproduce it. Can you give more information about error message, list of files in your scripts
directory, version of Go, version go-bindata that you were using? Thank you.
@SQLServerIO Can you please try again with latest version. Thank you.