Skip to content

Instantly share code, notes, and snippets.

@agarzon
Created November 12, 2018 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agarzon/8d576ed79b958a5f1f3e2a6c302b603f to your computer and use it in GitHub Desktop.
Save agarzon/8d576ed79b958a5f1f3e2a6c302b603f to your computer and use it in GitHub Desktop.
Zibo texture selector for x-plane
// This command line program helps to install 4k or 2k textures in the Zibo's B738
// Author: Alexander Garzon
// Multi-platform. It should work with WIN, OS and Linux. Just be sure the file has execution permisstions.
// Tested with Zibo 3.31
package main
import (
"fmt"
"io"
"os"
"github.com/manifoldco/promptui"
)
func main() {
prompt := promptui.Select{
Label: "Select desired texture resolution to be installed in your Zibo's B738",
Items: []string{"4k", "2k"},
}
_, result, err := prompt.Run()
if err != nil {
fmt.Printf("Prompt failed %v\n", err)
return
}
var source = "ACF_2k_4k/b738.acf.4k" // default
if result == "4k" {
source = "ACF_2k_4k/b738.acf.4k"
}
if result == "2k" {
source = "ACF_2k_4k/b738.acf.2k"
}
r, err := os.Open(source)
if err != nil {
panic(err)
}
defer r.Close()
w, err := os.Create("b738.acf")
if err != nil {
panic(err)
}
defer w.Close()
// do the actual work
n, err := io.Copy(w, r)
if err != nil {
panic(err)
}
fmt.Printf("Copied %v bytes\n", n)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment