func (app *Application) doActivateFile(f *gio.File, args []string, isExecutable bool, contentType string, timestamp uint32, flag int32) error { plainType := "text/plain" file := utils.DecodeURI(f.GetUri()) if isExecutable && (contentTypeCanBeExecutable(contentType) || strings.HasSuffix(file, ".bin")) { if contentTypeIs(contentType, plainType) { // runable file switch flag { case app.ActivateFlagRunInTerminal: runInTerminal("", file) return nil case app.ActivateFlagRun: handler := exec.Command(file) err := handler.Start() go handler.Wait() return err case app.ActivateFlagDisplay: return app.doDisplayFile(f, contentType, timestamp) } } else { // binary file // FIXME: strange logic from dde-workspace, why args is not used on the other places. handler := exec.Command(file, args...) err := handler.Start() go handler.Wait() return err } } return app.doDisplayFile(f, contentType, timestamp) }
func getBaseName(uri string) string { return filepath.Base(utils.DecodeURI(uri)) }