Skip to content

Commit

Permalink
Use relative paths and fix dir permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
leifcr committed Feb 6, 2019
1 parent 429a995 commit 81af4cf
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions bi5/bi5.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"path/filepath"
"time"

"github.com/adyzng/go-duka/core"
"github.com/adyzng/go-duka/misc"
"../core"
"../misc"
"github.com/kjk/lzma"
)

Expand Down Expand Up @@ -87,15 +87,15 @@ func (b *Bi5) Save(data []byte) error {
return nil
}

if err := os.MkdirAll(b.dest, 666); err != nil {
if err := os.MkdirAll(b.dest, 0755); err != nil {
log.Error("Create folder (%s) failed: %v.", b.dest, err)
return err
}

fname := fmt.Sprintf("%02dh.%s", b.dayH.Hour(), ext)
fpath := filepath.Join(b.dest, fname)

f, err := os.OpenFile(fpath, os.O_CREATE|os.O_TRUNC|os.O_RDWR, 666)
f, err := os.OpenFile(fpath, os.O_CREATE|os.O_TRUNC|os.O_RDWR, 0666)
if err != nil {
log.Error("Create file %s failed: %v.", fpath, err)
return err
Expand All @@ -118,7 +118,7 @@ func (b *Bi5) Load() ([]byte, error) {
fname := fmt.Sprintf("%02dh.%s", b.dayH.Hour(), ext)
fpath := filepath.Join(b.dest, fname)

f, err := os.OpenFile(fpath, os.O_RDONLY, 666)
f, err := os.OpenFile(fpath, os.O_RDONLY, 0666)
if err != nil {
if os.IsNotExist(err) {
log.Trace("Bi5 (%s) not exist, try to download from dukascopy", fpath)
Expand Down
2 changes: 1 addition & 1 deletion core/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"
"time"

"github.com/adyzng/go-duka/misc"
"../misc"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions csv/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"path/filepath"
"time"

"github.com/adyzng/go-duka/core"
"github.com/adyzng/go-duka/misc"
"../core"
"../misc"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion csv/csv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/adyzng/go-duka/bi5"
"../bi5"
)

func TestCloseChan(t *testing.T) {
Expand Down
12 changes: 6 additions & 6 deletions dukapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (
"sync"
"time"

"github.com/adyzng/go-duka/bi5"
"github.com/adyzng/go-duka/core"
"github.com/adyzng/go-duka/csv"
"github.com/adyzng/go-duka/fxt4"
"github.com/adyzng/go-duka/hst"
"github.com/adyzng/go-duka/misc"
"./bi5"
"./core"
"./csv"
"./fxt4"
"./hst"
"./misc"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion fxt4/fxt4.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"os"
"path/filepath"

"github.com/iizotop/go-duka/core"
"../core"
//"github.com/iizotop/go-duka/misc"
)

Expand Down
2 changes: 1 addition & 1 deletion fxt4/fxt4_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os"
"testing"

"github.com/adyzng/go-duka/core"
"../core"
)

func TestFxtFile(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion fxt4/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"
"log"

"github.com/adyzng/go-duka/misc"
"../misc"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion hst/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/adyzng/go-duka/misc"
"../misc"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions hst/hst401.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"
"path/filepath"

"github.com/adyzng/go-duka/core"
"github.com/adyzng/go-duka/misc"
"../core"
"../misc"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"path/filepath"
"time"

"github.com/adyzng/go-duka/fxt4"
"./fxt4"
"github.com/go-clog/clog"
)

Expand Down

0 comments on commit 81af4cf

Please sign in to comment.