Skip to content

Commit

Permalink
Merge pull request #1 from bi-zone/version_info_fillinf
Browse files Browse the repository at this point in the history
Create library for windows file version info
  • Loading branch information
Maria Samoylova authored Aug 26, 2019
2 parents aa5225e + a301281 commit 8535cf6
Show file tree
Hide file tree
Showing 6 changed files with 449 additions and 0 deletions.
Binary file modified README.md
Binary file not shown.
Binary file added assets/explorer_properties.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions examples/file_info/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package main

import (
"fmt"
"log"
"os"

"github.com/bi-zone/go-fileversion"
)

func main() {
if len(os.Args) < 2 {
log.Fatal("Usage: ./file_info.exe <image-path>")
}
f, err := fileversion.New(os.Args[1])
if err != nil {
log.Fatal(err)
}
fmt.Println("CompanyName:", f.CompanyName())
fmt.Println("FileDescription:", f.FileDescription())
fmt.Println("FileVersion:", f.FileVersion())
fmt.Println("InternalName:", f.InternalName())
fmt.Println("LegalCopyright:", f.LegalCopyright())
fmt.Println("OriginalFilename:", f.OriginalFilename())
fmt.Println("ProductName:", f.ProductName())
fmt.Println("ProductVersion:", f.ProductVersion())
fmt.Println("Comments:", f.Comments())
fmt.Println("LegalTrademarks:", f.LegalTrademarks())
fmt.Println("PrivateBuild:", f.PrivateBuild())
fmt.Println("SpecialBuild:", f.SpecialBuild())

fixedInfo := f.FixedInfo()
fmt.Printf("FixedInfo:\n%+v\n", fixedInfo)
fmt.Println("File version:", fixedInfo.FileVersion)
fmt.Println("Product version:", fixedInfo.ProductVersion)

fmt.Printf("Locales: %+v\n", f.Locales)

// https://docs.microsoft.com/en-us/windows/win32/menurc/versioninfo-resource
germanLocale := fileversion.Locale{
LangID: 0x0407, // langID German
CharsetID: fileversion.CSUnicode,
}
fmt.Println(f.GetPropertyWithLocale("PropertyName", germanLocale))
}
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/bi-zone/go-fileversion

go 1.12

require golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Loading

0 comments on commit 8535cf6

Please sign in to comment.