Simplified app.manifest since full version was not working

This commit is contained in:
Internet Addict 2025-02-19 09:21:08 +00:00
parent 99d6eee147
commit d4ad91a85d

View file

@ -39,20 +39,14 @@ func main() {
*version = now + ".0" *version = now + ".0"
} }
// Choose the requested execution level based on the requireAdmin flag. // --- Generate app.manifest ---
executionLevel := "asInvoker" level := "asInvoker"
if *requireAdmin { if *requireAdmin {
executionLevel = "requireAdministrator" level = "requireAdministrator"
} }
// --- Generate app.manifest ---
manifestContent := fmt.Sprintf(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?> manifestContent := fmt.Sprintf(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
name="%s"
version="%s"
processorArchitecture="*"
type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security> <security>
<requestedPrivileges> <requestedPrivileges>
@ -60,13 +54,8 @@ func main() {
</requestedPrivileges> </requestedPrivileges>
</security> </security>
</trustInfo> </trustInfo>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware>true/PM</dpiAware>
</windowsSettings>
</application>
</assembly> </assembly>
`, *name, *version, executionLevel) `, level)
if err := os.WriteFile("app.manifest", []byte(manifestContent), 0644); err != nil { if err := os.WriteFile("app.manifest", []byte(manifestContent), 0644); err != nil {
fmt.Println("Error writing app.manifest:", err) fmt.Println("Error writing app.manifest:", err)
@ -99,7 +88,9 @@ func main() {
} }
fileVersion := fmt.Sprintf("%s,%s,%s,%s", v1, v2, v3, v4) fileVersion := fmt.Sprintf("%s,%s,%s,%s", v1, v2, v3, v4)
// Note: We use "2 RT_MANIFEST" so it doesn't collide with the VERSIONINFO (ID=1). // Generate the resource script.
// Note: The manifest is embedded here under resource ID 1 (type 24), but after running, it's enforced by mt.exe.
// I'm not sure if I should remove mt.exe enforcement or remove it here.
rcContent := fmt.Sprintf(`1 VERSIONINFO rcContent := fmt.Sprintf(`1 VERSIONINFO
FILEVERSION %s FILEVERSION %s
PRODUCTVERSION %s PRODUCTVERSION %s