replaceRingPath returns the contents of the file at path with secringPlaceholder replaced with the absolute path of relativeRing.
(path string)
| 133 | |
| 134 | // replaceRingPath returns the contents of the file at path with secringPlaceholder replaced with the absolute path of relativeRing. |
| 135 | func replaceRingPath(path string) ([]byte, error) { |
| 136 | secRing, err := filepath.Abs(relativeRing) |
| 137 | if err != nil { |
| 138 | return nil, fmt.Errorf("Could not get absolute path of %v: %v", relativeRing, err) |
| 139 | } |
| 140 | secRing = strings.Replace(secRing, `\`, `\\`, -1) |
| 141 | slurpBytes, err := os.ReadFile(path) |
| 142 | if err != nil { |
| 143 | return nil, err |
| 144 | } |
| 145 | |
| 146 | // twice: once in search owner, and once in sighelper. |
| 147 | return bytes.Replace(slurpBytes, []byte(secringPlaceholder), []byte(secRing), 2), nil |
| 148 | } |
| 149 | |
| 150 | // We just need to make sure that we don't match the prefix handlers too. |
| 151 | var unixPathPattern = regexp.MustCompile(`"/.*/.+"`) |
no outgoing calls
no test coverage detected