Skip to content

Commit 72f8441

Browse files
committed
feat: allow path to include trailing slash
1 parent 822a7bc commit 72f8441

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tmux/tmux.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,14 @@ func execTmuxp(name string, command string) error {
146146
return nil
147147
}
148148

149+
func removeTrailingSlash(path string) string {
150+
return strings.TrimRight(path, "/")
151+
}
152+
149153
func getStartupScript(sessionPath string, config *config.Config) string {
150154
for _, sessionConfig := range config.SessionConfigs {
151155
// TODO: get working with /* again
152-
scriptFullPath := dir.FullPath(sessionConfig.Path)
156+
scriptFullPath := removeTrailingSlash(dir.FullPath(sessionConfig.Path))
153157
match, _ := filepath.Match(scriptFullPath, sessionPath)
154158
if match {
155159
return sessionConfig.StartupScript
@@ -160,7 +164,7 @@ func getStartupScript(sessionPath string, config *config.Config) string {
160164

161165
func getStartupCommand(sessionPath string, config *config.Config) string {
162166
for _, sessionConfig := range config.SessionConfigs {
163-
scriptFullPath := dir.FullPath(sessionConfig.Path)
167+
scriptFullPath := removeTrailingSlash(dir.FullPath(sessionConfig.Path))
164168
match, _ := filepath.Match(scriptFullPath, sessionPath)
165169
if match {
166170
return sessionConfig.StartupCommand

0 commit comments

Comments
 (0)