mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Added .tar.* file ending
This commit is contained in:
parent
600eaeeeca
commit
60fed00b0e
1 changed files with 6 additions and 2 deletions
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"os/user"
|
"os/user"
|
||||||
"path"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
@ -81,8 +80,13 @@ func createOrDefaultClient(proxy string) (*http.Client, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func freeFileName(filename string) (string, bool) {
|
func freeFileName(filename string) (string, bool) {
|
||||||
ext := path.Ext(filename)
|
ext := filepath.Ext(filename)
|
||||||
base := strings.TrimSuffix(filename, ext)
|
base := strings.TrimSuffix(filename, ext)
|
||||||
|
// checks if a .tar stands before the "actual" file ending
|
||||||
|
if extraExt := filepath.Ext(base); extraExt == ".tar" {
|
||||||
|
ext = extraExt + ext
|
||||||
|
base = strings.TrimSuffix(base, extraExt)
|
||||||
|
}
|
||||||
j := 0
|
j := 0
|
||||||
for ; ; j++ {
|
for ; ; j++ {
|
||||||
if _, stat := os.Stat(filename); stat != nil && !os.IsExist(stat) {
|
if _, stat := os.Stat(filename); stat != nil && !os.IsExist(stat) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue