forked from strangelove-ventures/interchaintest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathibctest.go
30 lines (27 loc) · 773 Bytes
/
ibctest.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package ibctest
import (
"fmt"
"os"
"path/filepath"
)
// CreateLogFile creates a file with name in dir $HOME/.ibctest/logs/
func CreateLogFile(name string) (*os.File, error) {
home, err := os.UserHomeDir()
if err != nil {
return nil, fmt.Errorf("user home dir: %w", err)
}
fpath := filepath.Join(home, ".ibctest", "logs")
err = os.MkdirAll(fpath, 0755)
if err != nil {
return nil, fmt.Errorf("mkdirall: %w", err)
}
return os.Create(filepath.Join(fpath, name))
}
// DefaultBlockDatabaseFilepath is the default filepath to the sqlite database for tracking blocks and transactions.
func DefaultBlockDatabaseFilepath() string {
home, err := os.UserHomeDir()
if err != nil {
panic(err)
}
return filepath.Join(home, ".ibctest", "databases", "block.db")
}