Add GetExePath func.

This commit is contained in:
Daniel Theophanes
2012-05-11 01:29:06 -07:00
parent a172bea54d
commit 0056a72596
2 changed files with 11 additions and 0 deletions
+7
View File
@@ -34,3 +34,10 @@ type Service interface {
LogWarning(format string, a ...interface{}) error
LogInfo(format string, a ...interface{}) error
}
// Returns the full path of the running executable
// as reported by the system. Includes the executable
// image name.
func GetExePath() (exePath string, err error) {
return getExePath()
}
+4
View File
@@ -104,6 +104,10 @@ func (ws *windowsService) LogInfo(format string, a ...interface{}) error {
return writeToEventLog(ws.name, fmt.Sprintf(format, a ...), levelInfo)
}
func getExePath() (exePath string, err error) {
return getModuleFileName()
}
var (
advapi = syscall.MustLoadDLL("advapi32.dll")
kernel = syscall.MustLoadDLL("kernel32.dll")