Skip to content

Commit 0d16f52

Browse files
committed
fix: inital path os
1 parent b34b1e0 commit 0d16f52

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hostify.json

handlers/initHandler.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,28 @@ import (
44
"fmt"
55
"hostify/io"
66
"os"
7+
"runtime"
78
)
89

910
// InitialPackage create a initial hostify file
1011
func InitialPackage() {
1112

1213
var path string
1314

15+
_os := runtime.GOOS
16+
17+
switch _os {
18+
case "windows":
19+
path = "\\hostify.json"
20+
case "darwin":
21+
path = "/hostify.json"
22+
case "linux":
23+
path = "/hostify.json"
24+
default:
25+
path = "/hostify.json"
26+
}
1427

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

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

3851
if err == nil {
3952
file.Close()
40-
done := fmt.Sprintf("Done: %v bites writes", bitesWriter)
53+
done := fmt.Sprintf("%v bites writes", bitesWriter)
4154
io.SuccessMessage(done)
4255
os.Exit(0)
4356
} else {

hostify.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
"description": "Name here",
44
"version": "1.0.0",
55
"entry": "...",
6-
"repository": "https://github.com/{ owner }/ { repo name }",
6+
"repository": "https://github.com/{ owner }/{ repo name }",
77
"files": ["...", "...", "..."]
88
}

0 commit comments

Comments
 (0)