I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 8ceb6645 authored by aargh's avatar aargh
Browse files

sanity check the startup directory

parent 158212a8
No related branches found
No related tags found
No related merge requests found
......@@ -38,8 +38,9 @@ func NewGUI() *GUI {
// Start launches a new syndie-gui application
func (client *GUI) Start(path string) {
sanityCheckStartupDir(path)
client.db = newDatabase()
client.db.openDB(path)
client.db.openDB(path + "/db/bolt.db")
client.db.reload()
a := app.New()
......@@ -98,3 +99,15 @@ func (client *GUI) fetch(fetch bool) {
func (client *GUI) applyOptions() {
client.pagination = 25
}
func sanityCheckStartupDir(path string) {
var err error
_, err = os.Stat(path)
if os.IsNotExist(err) {
os.Mkdir(path, 0777)
_, err = os.Stat(path + "/db/")
if os.IsNotExist(err) {
os.Mkdir(path+"/db/", 0777)
}
}
}
......@@ -11,5 +11,5 @@ func main() {
if err != nil {
panic("Error obtaining current user")
}
client.Start(usr.HomeDir + "/.syndie/db/bolt.db")
client.Start(usr.HomeDir + "/.syndie")
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment