mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55:40 +00:00
gpu/internal/convertshaders: batch calls to winepath
Wine tools can be slow to run, so it makes sense to batch their use. Fortunately, winepath supports resolving multiple paths in one execution. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -117,12 +117,17 @@ func (dxc *DXC) Compile(path, variant string, input []byte, entryPoint string, p
|
|||||||
// winepath uses the winepath tool to convert a paths to Windows format.
|
// winepath uses the winepath tool to convert a paths to Windows format.
|
||||||
// The returned path can be used as arguments for Windows command line tools.
|
// The returned path can be used as arguments for Windows command line tools.
|
||||||
func winepath(paths ...*string) error {
|
func winepath(paths ...*string) error {
|
||||||
|
winepath := exec.Command("winepath", "--windows")
|
||||||
for _, path := range paths {
|
for _, path := range paths {
|
||||||
out, err := exec.Command("winepath", "--windows", *path).Output()
|
winepath.Args = append(winepath.Args, *path)
|
||||||
if err != nil {
|
}
|
||||||
return fmt.Errorf("unable to run `winepath --windows %q`: %w", *path, err)
|
out, err := winepath.Output()
|
||||||
}
|
if err != nil {
|
||||||
*path = strings.TrimSpace(string(out))
|
return fmt.Errorf("unable to run `winepath --windows`: %w", err)
|
||||||
|
}
|
||||||
|
winPaths := strings.Split(strings.TrimSpace(string(out)), "\n")
|
||||||
|
for i, path := range paths {
|
||||||
|
*path = winPaths[i]
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user