ebitenutil: Seal OpenFile on mobiles

This commit is contained in:
Hajime Hoshi 2016-06-25 02:30:27 +09:00
parent bf807799bf
commit 7d99ce35ba
2 changed files with 9 additions and 0 deletions

View File

@ -12,7 +12,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build darwin linux windows
// +build !js // +build !js
// +build !android
// +build !ios
package ebitenutil package ebitenutil
@ -23,6 +26,7 @@ import (
// OpenFile opens a file and returns a stream for its data. // OpenFile opens a file and returns a stream for its data.
// //
// This function is available both on desktops and browsers. // This function is available both on desktops and browsers.
// Note that this doesn't work on mobiles.
func OpenFile(path string) (ReadSeekCloser, error) { func OpenFile(path string) (ReadSeekCloser, error) {
return os.Open(path) return os.Open(path)
} }

View File

@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build darwin,!arm,!arm64 linux windows
// +build !android
// +build !ios
package ebitenutil package ebitenutil
import ( import (
@ -23,6 +27,7 @@ import (
// NewImageFromFile loads the file path and returns ebiten.Image and image.Image. // NewImageFromFile loads the file path and returns ebiten.Image and image.Image.
// //
// The current directory for path depends on your environment. This will vary on your desktop or web browser. // The current directory for path depends on your environment. This will vary on your desktop or web browser.
// Note that this doesn't work on browsers.
// It'll be safer to embed your resource, e.g., with github.com/jteeuwen/go-bindata instead of using this function. // It'll be safer to embed your resource, e.g., with github.com/jteeuwen/go-bindata instead of using this function.
func NewImageFromFile(path string, filter ebiten.Filter) (*ebiten.Image, image.Image, error) { func NewImageFromFile(path string, filter ebiten.Filter) (*ebiten.Image, image.Image, error) {
file, err := OpenFile(path) file, err := OpenFile(path)