aboutsummaryrefslogtreecommitdiffstats
path: root/internal/build
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-11-09 05:55:39 +0800
committerFelix Lange <fjl@twurst.com>2016-11-09 05:55:39 +0800
commit9bc97a5785d3d350a084b46fc77a8439b8dc533b (patch)
tree1802db150e1fed6272e08dd17b85a8a188ee55c8 /internal/build
parent6707f70b4a947a06fdcf564619e6c8220a6654ad (diff)
downloaddexon-9bc97a5785d3d350a084b46fc77a8439b8dc533b.tar
dexon-9bc97a5785d3d350a084b46fc77a8439b8dc533b.tar.gz
dexon-9bc97a5785d3d350a084b46fc77a8439b8dc533b.tar.bz2
dexon-9bc97a5785d3d350a084b46fc77a8439b8dc533b.tar.lz
dexon-9bc97a5785d3d350a084b46fc77a8439b8dc533b.tar.xz
dexon-9bc97a5785d3d350a084b46fc77a8439b8dc533b.tar.zst
dexon-9bc97a5785d3d350a084b46fc77a8439b8dc533b.zip
build: NSIS based Windows installer (#3240)
This commit adds support for creating Windows installers to ci.go
Diffstat (limited to 'internal/build')
-rw-r--r--internal/build/util.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/build/util.go b/internal/build/util.go
index a821cd7f2..ce17ce220 100644
--- a/internal/build/util.go
+++ b/internal/build/util.go
@@ -20,6 +20,7 @@ import (
"bytes"
"flag"
"fmt"
+ "io"
"io/ioutil"
"log"
"os"
@@ -117,3 +118,25 @@ func render(tpl *template.Template, outputFile string, outputPerm os.FileMode, x
log.Fatal(err)
}
}
+
+// CopyFile copies a file.
+func CopyFile(dst, src string, mode os.FileMode) {
+ if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil {
+ log.Fatal(err)
+ }
+ destFile, err := os.OpenFile(dst, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, mode)
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer destFile.Close()
+
+ srcFile, err := os.Open(src)
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer srcFile.Close()
+
+ if _, err := io.Copy(destFile, srcFile); err != nil {
+ log.Fatal(err)
+ }
+}