File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -35,12 +35,21 @@ func Zip(filePath []string, zipPath string) error {
3535 if err != nil {
3636 return err
3737 }
38+ if path == fPath {
39+ return nil
40+ }
3841 var zipfile io.Writer
42+ if ! strings .HasSuffix (filepath .Dir (fPath ), `\` ) {
43+ fPath = filepath .Dir (fPath ) + `\`
44+ }
3945 if info .IsDir () {
40- _ , err = zw .Create (strings .TrimPrefix (path , filepath .Dir (fPath )) + `/` )
46+ if ! strings .HasSuffix (path , `\` ) && ! strings .HasSuffix (path , `/` ) {
47+ path = path + `/`
48+ }
49+ _ , err = zw .Create (strings .TrimPrefix (path , fPath ))
4150 return err
4251 } else {
43- zipfile , err = zw .Create (strings .TrimPrefix (path , filepath . Dir ( fPath ) ))
52+ zipfile , err = zw .Create (strings .TrimPrefix (path , fPath ))
4453 if err != nil {
4554 return err
4655 }
You can’t perform that action at this time.
0 commit comments