Documentation
¶
Overview ¶
Package executable answers what a platform means by "a program".
Two questions, and both have a POSIX answer this repository had inlined in five places: a program is a file with an execute bit, and it is stored under the name it is called by. Windows agrees with neither. It has no execute bit -- Go reports every regular file as 0666, so a permission test for one answers "not a program" about every program on the disk -- and it decides what it will run from the extension, which is also part of the file name a caller has to look for.
Neither difference is deep, which is exactly why it kept being written out by hand and getting it wrong was silent: the checks did not fail, they answered no.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BaseName ¶
BaseName returns the name a program is called by, given the path it is stored at. Here the two are the same.
The empty path is answered with the empty name rather than with what filepath.Base makes of it, which is ".". A comparison against "." would match a program called that and nothing else, which is a worse answer than no answer.
func Candidates ¶
Candidates are the file names this platform would try when looking for a program called base, in the order it would try them.
Here there is one, which is why the distinction between naming a program and finding one is invisible until it is not: Windows stores a program under one name and will run several, so a lookup that tried only Name would miss a perfectly good `.cmd`.
Types ¶
This section is empty.