From 64cad5d4a4ecc25a53218b547ed00fddf9f11ae0 Mon Sep 17 00:00:00 2001 From: Hussam Date: Thu, 25 Apr 2024 17:11:00 -0500 Subject: [PATCH] bugfix: Fix default path creation --- cmd/utils/flags.go | 2 +- node/defaults.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 4f431341db..441a0f2205 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -159,7 +159,7 @@ var ( DataDirFlag = Flag{ Name: c_GlobalFlagPrefix + "data-dir", Abbreviation: "d", - Value: xdg.DataHome + "/" + constants.APP_NAME + "/", + Value: filepath.Join(xdg.DataHome, constants.APP_NAME), Usage: "data directory" + generateEnvDoc(c_GlobalFlagPrefix+"data-dir"), } diff --git a/node/defaults.go b/node/defaults.go index bc7d1120b6..abb799b65d 100644 --- a/node/defaults.go +++ b/node/defaults.go @@ -17,7 +17,10 @@ package node import ( + "path/filepath" + "github.com/adrg/xdg" + "github.com/dominant-strategies/go-quai/common/constants" "github.com/dominant-strategies/go-quai/rpc" ) @@ -30,7 +33,7 @@ const ( // DefaultConfig contains reasonable default settings. var DefaultConfig = Config{ - DataDir: xdg.DataHome, + DataDir: filepath.Join(xdg.DataHome, constants.APP_NAME), HTTPPort: DefaultHTTPPort, HTTPModules: []string{"net", "web3"}, HTTPVirtualHosts: []string{"localhost"},