From 7429e8a7aa215dc5069cee1500b985d3891ffbc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E7=BA=A2=E5=B2=A9?= Date: Sun, 29 Jan 2023 19:10:31 +0800 Subject: [PATCH] v2.4.1 cmd package, templates --- cmd/internal/templates/app.desktop | 5 +++ cmd/internal/templates/app.manifest | 4 ++ cmd/internal/templates/app.plist | 62 +++++++++++++++++++++++++++++ common/common.go | 10 +++++ 4 files changed, 81 insertions(+) create mode 100644 cmd/internal/templates/app.desktop create mode 100644 cmd/internal/templates/app.manifest create mode 100644 cmd/internal/templates/app.plist diff --git a/cmd/internal/templates/app.desktop b/cmd/internal/templates/app.desktop new file mode 100644 index 0000000..9efeec3 --- /dev/null +++ b/cmd/internal/templates/app.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Type=Application +Name={{.Name}} +Exec={{.Exec}} +Icon={{.Name}} diff --git a/cmd/internal/templates/app.manifest b/cmd/internal/templates/app.manifest new file mode 100644 index 0000000..3d88692 --- /dev/null +++ b/cmd/internal/templates/app.manifest @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/cmd/internal/templates/app.plist b/cmd/internal/templates/app.plist new file mode 100644 index 0000000..4be22c4 --- /dev/null +++ b/cmd/internal/templates/app.plist @@ -0,0 +1,62 @@ + + + + + NSPrincipalClass + TCrCocoaApplication + LSUIElement + <{{.LSUIElement}}/> + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + {{.execName}} + CFBundleLocalizations + + {{.locale}} + + CFBundleName + {{.execName}} + CFBundleIdentifier + com.{{.execName}} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + proj + CFBundleShortVersionString + 0.1 + CFBundleVersion + 1 + CSResourcesFileMapped + + CFBundleIconFile + {{.execName}}.icns + CFBundleDocumentTypes + + + CFBundleTypeRole + Viewer + CFBundleTypeExtensions + + * + + CFBundleTypeOSTypes + + fold + disk + **** + + + + NSHighResolutionCapable + + NSHumanReadableCopyright + {{.copyright}}> + + \ No newline at end of file diff --git a/common/common.go b/common/common.go index 9393cca..b94d989 100644 --- a/common/common.go +++ b/common/common.go @@ -755,3 +755,13 @@ func GetInstancePtr(ptr uintptr) unsafe.Pointer { ptr = *(*uintptr)(unsafe.Pointer(ptr)) return unsafe.Pointer(ptr) } + +//GoroutineID 获取当前携程ID +func GoroutineID() (id uint64) { + var buf [30]byte + runtime.Stack(buf[:], false) + for i := 10; buf[i] != ' '; i++ { + id = id*10 + uint64(buf[i]&15) + } + return id +} -- GitLab