bcvery1 / tilepix

Library for combining tiled maps with pixel
MIT License
46 stars 14 forks source link

virtual filesystem support #98

Closed aerth closed 4 years ago

aerth commented 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.

This makes it impossible to use tilepix.Read with virtual filesystem such as go-bindata or vfsgen (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.Open

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