ebitenutil: deprecate some APIs

This commit is contained in:
Hajime Hoshi 2022-08-04 16:23:46 +09:00
parent c98501060f
commit 65654f0fc4
3 changed files with 12 additions and 1 deletions

View File

@ -28,6 +28,13 @@ func (f *file) Close() error {
return nil return nil
} }
// OpenFile opens a file and returns a stream for its data.
//
// The path parts should be separated with slash '/' on any environments.
//
// OpenFile doesn't work on mobiles.
//
// Deprecated: as of v2.4. Use os.Open on desktops and http.Get on browsers instead.
func OpenFile(path string) (ReadSeekCloser, error) { func OpenFile(path string) (ReadSeekCloser, error) {
res, err := http.Get(path) res, err := http.Get(path)
if err != nil { if err != nil {

View File

@ -26,7 +26,9 @@ import (
// //
// The path parts should be separated with slash '/' on any environments. // The path parts should be separated with slash '/' on any environments.
// //
// Note that this doesn't work on mobiles. // OpenFile doesn't work on mobiles.
//
// Deprecated: as of v2.4. Use os.Open on desktops and http.Get on browsers instead.
func OpenFile(path string) (ReadSeekCloser, error) { func OpenFile(path string) (ReadSeekCloser, error) {
return os.Open(filepath.FromSlash(path)) return os.Open(filepath.FromSlash(path))
} }

View File

@ -19,6 +19,8 @@ import (
) )
// ReadSeekCloser is io.ReadSeeker and io.Closer. // ReadSeekCloser is io.ReadSeeker and io.Closer.
//
// Deprecated: as of v2.4. Use io.ReadSeekCloser instead.
type ReadSeekCloser interface { type ReadSeekCloser interface {
io.ReadSeeker io.ReadSeeker
io.Closer io.Closer