ethutil: remove Config variable
Various functions throughout the codebase used it to grab settings. This has to stop because I want to use them without reading the config file. These functions can now be used without reading the config first: * ethdb.NewLDBDatabase * ethrepl.NewJSRepl * vm.New
This commit is contained in:
@ -54,7 +54,7 @@ type JSRepl struct {
|
||||
}
|
||||
|
||||
func NewJSRepl(ethereum *eth.Ethereum) *JSRepl {
|
||||
hist, err := os.OpenFile(path.Join(ethutil.Config.ExecPath, "history"), os.O_RDWR|os.O_CREATE, os.ModePerm)
|
||||
hist, err := os.OpenFile(path.Join(ethereum.DataDir, "history"), os.O_RDWR|os.O_CREATE, os.ModePerm)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -79,14 +79,14 @@ func (self *Gui) AddPlugin(pluginPath string) {
|
||||
self.plugins[pluginPath] = plugin{Name: pluginPath, Path: pluginPath}
|
||||
|
||||
json, _ := json.MarshalIndent(self.plugins, "", " ")
|
||||
ethutil.WriteFile(ethutil.Config.ExecPath+"/plugins.json", json)
|
||||
ethutil.WriteFile(self.eth.DataDir+"/plugins.json", json)
|
||||
}
|
||||
|
||||
func (self *Gui) RemovePlugin(pluginPath string) {
|
||||
delete(self.plugins, pluginPath)
|
||||
|
||||
json, _ := json.MarshalIndent(self.plugins, "", " ")
|
||||
ethutil.WriteFile(ethutil.Config.ExecPath+"/plugins.json", json)
|
||||
ethutil.WriteFile(self.eth.DataDir+"/plugins.json", json)
|
||||
}
|
||||
|
||||
// this extra function needed to give int typecast value to gui widget
|
||||
|
@ -100,7 +100,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, session st
|
||||
plugins: make(map[string]plugin),
|
||||
serviceEvents: make(chan ServEv, 1),
|
||||
}
|
||||
data, _ := ethutil.ReadAllFile(path.Join(ethutil.Config.ExecPath, "plugins.json"))
|
||||
data, _ := ethutil.ReadAllFile(path.Join(ethereum.DataDir, "plugins.json"))
|
||||
json.Unmarshal([]byte(data), &gui.plugins)
|
||||
|
||||
return gui
|
||||
|
Reference in New Issue
Block a user