mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Compare commits
3 Commits
29946d037b
...
098380ce06
Author | SHA1 | Date | |
---|---|---|---|
|
098380ce06 | ||
|
3e0c2c10bd | ||
|
daa85d17c2 |
10
.github/workflows/test.yml
vendored
10
.github/workflows/test.yml
vendored
@ -42,11 +42,15 @@ jobs:
|
||||
sudo apt-get update
|
||||
sudo apt-get install libasound2-dev libgl1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev
|
||||
|
||||
- name: Install Chrome
|
||||
uses: browser-actions/setup-chrome@latest
|
||||
|
||||
- name: Install wasmbrowsertest
|
||||
run: |
|
||||
go install github.com/agnivade/wasmbrowsertest@ee76d31b7b9b1645576c1f51fec4c09fe6cf1bb3
|
||||
wasmbrowsertest_version=06679196c7e76f227e71456cdc16fccd6cc33601
|
||||
go install github.com/agnivade/wasmbrowsertest@${wasmbrowsertest_version}
|
||||
mv $(go env GOPATH)/bin/wasmbrowsertest${{ runner.os == 'Windows' && '.exe' || '' }} $(go env GOPATH)/bin/go_js_wasm_exec${{ runner.os == 'Windows' && '.exe' || '' }}
|
||||
go install github.com/agnivade/wasmbrowsertest/cmd/cleanenv@ee76d31b7b9b1645576c1f51fec4c09fe6cf1bb3
|
||||
go install github.com/agnivade/wasmbrowsertest/cmd/cleanenv@${wasmbrowsertest_version}
|
||||
|
||||
- name: Prepare ebitenmobile test
|
||||
run: |
|
||||
@ -171,7 +175,7 @@ jobs:
|
||||
run: |
|
||||
# Wasm tests don't work on macOS with the headless mode, and the headless mode doesn't work in GitHub Actions (#2972).
|
||||
# Wasm tests don't work on Windows well due to mysterious timeouts (#2982).
|
||||
env GOOS=js GOARCH=wasm cleanenv -remove-prefix GITHUB_ -remove-prefix JAVA_ -remove-prefix PSModulePath -remove-prefix STATS_ -remove-prefix RUNNER_ -- go test -shuffle=on -v ./...
|
||||
env GOOS=js GOARCH=wasm cleanenv -remove-prefix GITHUB_ -remove-prefix JAVA_ -remove-prefix PSModulePath -remove-prefix STATS_ -remove-prefix RUNNER_ -- go test -shuffle=on -v ./... -test.paniconexit0=false
|
||||
|
||||
- name: Install ebitenmobile
|
||||
run: |
|
||||
|
@ -29,15 +29,22 @@ import (
|
||||
)
|
||||
|
||||
type VirtualFS struct {
|
||||
root virtualFSRoot
|
||||
paths []string
|
||||
}
|
||||
|
||||
func NewVirtualFS(paths []string) *VirtualFS {
|
||||
fs := &VirtualFS{}
|
||||
fs.root.addRealPaths(paths)
|
||||
fs.paths = make([]string, len(paths))
|
||||
copy(fs.paths, paths)
|
||||
return fs
|
||||
}
|
||||
|
||||
func (v *VirtualFS) newRootFS() *virtualFSRoot {
|
||||
var root virtualFSRoot
|
||||
root.addRealPaths(v.paths)
|
||||
return &root
|
||||
}
|
||||
|
||||
func (v *VirtualFS) Open(name string) (fs.File, error) {
|
||||
if !fs.ValidPath(name) {
|
||||
return nil, &fs.PathError{
|
||||
@ -48,15 +55,16 @@ func (v *VirtualFS) Open(name string) (fs.File, error) {
|
||||
}
|
||||
|
||||
if name == "." {
|
||||
return &v.root, nil
|
||||
return v.newRootFS(), nil
|
||||
}
|
||||
|
||||
// A valid path must not include a token "." or "..", except for "." itself.
|
||||
es := strings.Split(name, "/")
|
||||
for _, realPath := range v.root.realPaths {
|
||||
for _, realPath := range v.paths {
|
||||
if filepath.Base(realPath) != es[0] {
|
||||
continue
|
||||
}
|
||||
// TODO: Does this work on Windows?
|
||||
return os.Open(filepath.Join(append([]string{realPath}, es[1:]...)...))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user