Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created May 12, 2014 12:14
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 anonymous/39211b4d6be2f042d7a5 to your computer and use it in GitHub Desktop.
Save anonymous/39211b4d6be2f042d7a5 to your computer and use it in GitHub Desktop.
diff -r 13b599e0c2a5 nrsc/nrsc.go
--- a/nrsc/nrsc.go Mon Dec 02 21:14:32 2013 -0800
+++ b/nrsc/nrsc.go Mon May 12 15:10:44 2014 +0300
@@ -35,6 +35,16 @@
return fmt.Sprintf("%s/nrsc-%d.zip", os.TempDir(), time.Now().Unix())
}
+func inArray(needle string, haystack []string) bool {
+ for _, val := range haystack {
+ if needle == val {
+ return true
+ }
+ }
+
+ return false
+}
+
func mkzip(root, zip string, zipArgs []string) error {
pwd, err := os.Getwd()
if err != nil {
@@ -47,6 +57,9 @@
defer os.Chdir(pwd)
args := []string{"-r", zip, "."}
+ if !inArray("-x", zipArgs) {
+ args = append(args, "-x", `.*`)
+ }
args = append(args, zipArgs...)
cmd := exec.Command("zip", args...)
@@ -75,14 +88,13 @@
return err
}
-
func fixZipOffset(exe string) error {
return exec.Command("zip", "-q", "-A", exe).Run()
}
func main() {
flag.Usage = func() {
- fmt.Println("usage: nrsc EXECTABLE RESOURCE_DIR [ZIP OPTIONS]")
+ fmt.Println("usage: nrsc EXECTABLE RESOURCE_DIR [ZIP OPTIONS]")
}
version := flag.Bool("version", false, "show version and exit")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment