Move "blender finder" from Worker-specific to common location
Manager's first-time wizard will have to be able to find Blender as well.
This commit is contained in:
parent
aa9837b5f0
commit
20f13257f7
14
internal/find_blender/find_blender.go
Normal file
14
internal/find_blender/find_blender.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package find_blender
|
||||||
|
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
import "errors"
|
||||||
|
|
||||||
|
var ErrNotAvailable = errors.New("not available on this platform")
|
||||||
|
|
||||||
|
// FindBlender returns the full path of a Blender executable.
|
||||||
|
// `ErrNotAvailable` is returned if no "blender finder" is available for the current platform.
|
||||||
|
func FindBlender() (string, error) {
|
||||||
|
// findBlender() is implemented in one of the platform-dependent files.
|
||||||
|
return findBlender()
|
||||||
|
}
|
10
internal/find_blender/nonwindows.go
Normal file
10
internal/find_blender/nonwindows.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
//go:build !windows
|
||||||
|
|
||||||
|
package find_blender
|
||||||
|
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
// findBlender returns ErrNotAvailable, as the file association lookup is only available on Windows.
|
||||||
|
func findBlender() (string, error) {
|
||||||
|
return "", ErrNotAvailable
|
||||||
|
}
|
@ -1,8 +1,9 @@
|
|||||||
//go:build windows
|
//go:build windows
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
package find_blender
|
package find_blender
|
||||||
|
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -13,8 +14,8 @@ import (
|
|||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FindBlender returns the full path of `blender.exe` associated with ".blend" files.
|
// findBlender returns the full path of `blender.exe` associated with ".blend" files.
|
||||||
func FindBlender() (string, error) {
|
func findBlender() (string, error) {
|
||||||
exe, err := fileAssociation(".blend")
|
exe, err := fileAssociation(".blend")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
@ -1,8 +1,9 @@
|
|||||||
//go:build windows
|
//go:build windows
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
package find_blender
|
package find_blender
|
||||||
|
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"testing"
|
"testing"
|
||||||
@ -15,7 +16,7 @@ var withBlender = flag.Bool("withBlender", false, "run test that requires Blende
|
|||||||
// TestFindBlender is a "weak" test, which actually accepts both happy and unhappy flows.
|
// TestFindBlender is a "weak" test, which actually accepts both happy and unhappy flows.
|
||||||
// It would be too fragile to always require a file association to be set up with Blender.
|
// It would be too fragile to always require a file association to be set up with Blender.
|
||||||
func TestFindBlender(t *testing.T) {
|
func TestFindBlender(t *testing.T) {
|
||||||
exe, err := FindBlender()
|
exe, err := findBlender()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
assert.Empty(t, exe)
|
assert.Empty(t, exe)
|
||||||
|
|
@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/google/shlex"
|
"github.com/google/shlex"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
|
|
||||||
"git.blender.org/flamenco/internal/worker/find_blender"
|
"git.blender.org/flamenco/internal/find_blender"
|
||||||
"git.blender.org/flamenco/pkg/api"
|
"git.blender.org/flamenco/pkg/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
//go:build !windows
|
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
package find_blender
|
|
||||||
|
|
||||||
import "errors"
|
|
||||||
|
|
||||||
// FindBlender returns an error, as the file association lookup is only available on Windows.
|
|
||||||
func FindBlender() (string, error) {
|
|
||||||
return "", errors.New("file association lookup is only available on Windows")
|
|
||||||
}
|
|
@ -27,6 +27,10 @@
|
|||||||
{{ sharedStorageCheckResult.cause }}
|
{{ sharedStorageCheckResult.cause }}
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Which Blender?</h2>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer class="app-footer">
|
<footer class="app-footer">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user