mirror of
https://github.com/rwinkhart/cmutton.git
synced 2026-08-27 20:36:31 -04:00
Port GetCurrentDeviceID()
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
/cmutton.a
|
||||
/cmutton.h
|
||||
/test.c
|
||||
/testc
|
||||
/a.out
|
||||
|
||||
@@ -36,7 +36,7 @@ Build the C library + headers w/`go build -buildmode=c-archive`.
|
||||
- [ ] global
|
||||
- [X] DirInit(preserveOldCfgDir bool) (string, error)
|
||||
- [ ] ~~GenDeviceIDList() ([]fs.DirEntry, error)~~
|
||||
- [ ] GetCurrentDeviceID() (string, error)
|
||||
- [X] GetCurrentDeviceID() (string, error)
|
||||
- [ ] GetRealAgePath(vanityPath string) string
|
||||
- [ ] GetRealPath(vanityPath string) string
|
||||
- [ ] GetSysProcAttr() *syscall.SysProcAttr
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
// DirInit returns:
|
||||
// r0: oldDeviceID (special case: see libmutton docs)
|
||||
// r0: oldDeviceID (FSMisc if none)
|
||||
//
|
||||
// r1: err
|
||||
//
|
||||
@@ -22,4 +22,18 @@ func DirInit(preserveOldCfgDir bool) (*C.char, *C.char) {
|
||||
return C.CString(oldDeviceID), nil
|
||||
}
|
||||
|
||||
// GetCurrentDeviceID returns:
|
||||
// r0: currentDeviceID (FSMisc if none)
|
||||
//
|
||||
// r1: err
|
||||
//
|
||||
//export GetCurrentDeviceID
|
||||
func GetCurrentDeviceID() (*C.char, *C.char) {
|
||||
currentDeviceID, err := global.GetCurrentDeviceID()
|
||||
if err != nil {
|
||||
return nil, C.CString(err.Error())
|
||||
}
|
||||
return C.CString(currentDeviceID), nil
|
||||
}
|
||||
|
||||
func main() {}
|
||||
|
||||
Reference in New Issue
Block a user