-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathhtml.go
43 lines (33 loc) · 1 KB
/
html.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package html
import (
"path/filepath"
"github.com/itchio/butler/butlerd/messages"
"github.com/itchio/butler/butlerd"
"github.com/itchio/butler/endpoints/launch"
"github.com/pkg/errors"
)
func Register() {
launch.RegisterLauncher(launch.LaunchStrategyHTML, &Launcher{})
}
type Launcher struct{}
var _ launch.Launcher = (*Launcher)(nil)
func (l *Launcher) Do(params launch.LauncherParams) error {
rootFolder := params.InstallFolder
indexPath, err := filepath.Rel(rootFolder, params.FullTargetPath)
if err != nil {
return errors.WithStack(err)
}
messages.LaunchRunning.Notify(params.RequestContext, butlerd.LaunchRunningNotification{})
params.SessionStarted()
_, err = messages.HTMLLaunch.Call(params.RequestContext, butlerd.HTMLLaunchParams{
RootFolder: rootFolder,
IndexPath: indexPath,
Args: params.Args,
Env: params.Env,
})
messages.LaunchExited.Notify(params.RequestContext, butlerd.LaunchExitedNotification{})
if err != nil {
return errors.WithStack(err)
}
return nil
}