Closed aerth closed 4 years ago
Currently in the Read function there is an assumption that the tileset images exist on the disk, and internally os.Open is used. In ReadFile this is an understandable assumption, but if using Read, it's reasonable to assume we aren't using the disk.
Read
This makes it impossible to use tilepix.Read with virtual filesystem such as go-bindata or vfsgen (https://github.com/shurcooL/vfsgen)
tilepix.Read
go-bindata
vfsgen
Maybe we can accept a http.FileSystem (https://godoc.org/net/http#FileSystem) like vfsgen provides, and if nil use the normal os.Open
http.FileSystem
Here are relevant sections of code: https://github.com/bcvery1/tilepix/blob/master/tilepix.go#L108 https://github.com/bcvery1/tilepix/blob/master/tileset.go#L65
Currently in the
Read
function there is an assumption that the tileset images exist on the disk, and internally os.Open is used. In ReadFile this is an understandable assumption, but if usingRead
, it's reasonable to assume we aren't using the disk.This makes it impossible to use
tilepix.Read
with virtual filesystem such asgo-bindata
orvfsgen
(https://github.com/shurcooL/vfsgen)Maybe we can accept a
http.FileSystem
(https://godoc.org/net/http#FileSystem) like vfsgen provides, and if nil use the normal os.OpenHere are relevant sections of code: https://github.com/bcvery1/tilepix/blob/master/tilepix.go#L108 https://github.com/bcvery1/tilepix/blob/master/tileset.go#L65