Skip to content

Commit

Permalink
fix: inital path os
Browse files Browse the repository at this point in the history
  • Loading branch information
buttercubz committed Sep 21, 2020
1 parent b34b1e0 commit 0d16f52
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
hostify.json
17 changes: 15 additions & 2 deletions handlers/initHandler.go
Expand Up @@ -4,15 +4,28 @@ import (
"fmt"
"hostify/io"
"os"
"runtime"
)

// InitialPackage create a initial hostify file
func InitialPackage() {

var path string

_os := runtime.GOOS

switch _os {
case "windows":
path = "\\hostify.json"
case "darwin":
path = "/hostify.json"
case "linux":
path = "/hostify.json"
default:
path = "/hostify.json"
}

_, errExist := os.Stat(Cwd() + "\\hostify.json")
_, errExist := os.Stat(Cwd() + path)

// * verified if hostify file exist
if !os.IsNotExist(errExist) {
Expand All @@ -37,7 +50,7 @@ func InitialPackage() {

if err == nil {
file.Close()
done := fmt.Sprintf("Done: %v bites writes", bitesWriter)
done := fmt.Sprintf("%v bites writes", bitesWriter)
io.SuccessMessage(done)
os.Exit(0)
} else {
Expand Down
2 changes: 1 addition & 1 deletion hostify.json
Expand Up @@ -3,6 +3,6 @@
"description": "Name here",
"version": "1.0.0",
"entry": "...",
"repository": "https://github.com/{ owner }/ { repo name }",
"repository": "https://github.com/{ owner }/{ repo name }",
"files": ["...", "...", "..."]
}

0 comments on commit 0d16f52

Please sign in to comment.