CreateJunction creates a junction in Windows or a symlink in Linux/Mac.
(location, destination string)
| 335 | |
| 336 | // CreateJunction creates a junction in Windows or a symlink in Linux/Mac. |
| 337 | func CreateJunction(location, destination string) error { |
| 338 | CheckExistAndDelete(destination) |
| 339 | switch runtime.GOOS { |
| 340 | case "windows": |
| 341 | exec.Command("cmd", "/C", "rmdir", destination).Run() |
| 342 | return exec.Command("cmd", "/C", "mklink", "/J", destination, location).Run() |
| 343 | case "linux", "darwin": |
| 344 | return exec.Command("ln", "-Fsf", location, destination).Run() |
| 345 | } |
| 346 | |
| 347 | return nil |
| 348 | } |
| 349 | |
| 350 | func SeekToCloseParen(content string, regexpTerm string, leftChar, rightChar byte) string { |
| 351 | loc := regexp.MustCompile(regexpTerm).FindStringIndex(content) |
no test coverage detected