
Change the package base name of the Go code, from `git.blender.org/flamenco` to `projects.blender.org/studio/flamenco`. The old location, `git.blender.org`, has no longer been use since the [migration to Gitea][1]. The new package names now reflect the actual location where Flamenco is hosted. [1]: https://code.blender.org/2023/02/new-blender-development-infrastructure/
27 lines
719 B
Go
27 lines
719 B
Go
package job_compilers
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import (
|
|
"github.com/dop251/goja"
|
|
"github.com/rs/zerolog/log"
|
|
"projects.blender.org/studio/flamenco/pkg/crosspath"
|
|
)
|
|
|
|
// PathModule provides file path manipulation functions by wrapping Go's `path`.
|
|
func PathModule(r *goja.Runtime, module *goja.Object) {
|
|
obj := module.Get("exports").(*goja.Object)
|
|
|
|
mustExport := func(name string, value interface{}) {
|
|
err := obj.Set(name, value)
|
|
if err != nil {
|
|
log.Panic().Err(err).Msgf("unable to register '%s' in Goja 'path' module", name)
|
|
}
|
|
}
|
|
|
|
mustExport("basename", crosspath.Base)
|
|
mustExport("dirname", crosspath.Dir)
|
|
mustExport("join", crosspath.Join)
|
|
mustExport("stem", crosspath.Stem)
|
|
}
|