github.com/TeaOSLab/EdgeNode@v1.3.8/internal/utils/workspace.go (about)

     1  // Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
     2  
     3  package utils
     4  
     5  import "regexp"
     6  
     7  var workspaceReg = regexp.MustCompile(`/Edge[A-Z]\w+/`)
     8  
     9  func RemoveWorkspace(path string) string {
    10  	var indexes = workspaceReg.FindAllStringIndex(path, -1)
    11  	if len(indexes) > 0 {
    12  		return path[indexes[len(indexes)-1][0]:]
    13  	}
    14  	return path
    15  }