summaryrefslogtreecommitdiffstats
path: root/pkg/config
diff options
context:
space:
mode:
authorRyooooooga <eial5q265e5@gmail.com>2021-09-27 22:39:20 +0900
committerJesse Duffield <jessedduffield@gmail.com>2021-09-29 22:05:58 +1000
commit663c036ca5c5639c772a3f37ccef50ff03979337 (patch)
treec300e7ea60e80148244deb7627de1410b339522a /pkg/config
parentc8e9d1b4fcde97dbdeae3463ef80da2c61fe5371 (diff)
Save patch files in TempDir
Diffstat (limited to 'pkg/config')
-rw-r--r--pkg/config/app_config.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go
index b6d668439..6adfb9919 100644
--- a/pkg/config/app_config.go
+++ b/pkg/config/app_config.go
@@ -21,6 +21,7 @@ type AppConfig struct {
UserConfig *UserConfig
UserConfigDir string
UserConfigPath string
+ TempDir string
AppState *AppState
IsNewRepo bool
}
@@ -37,6 +38,7 @@ type AppConfigurer interface {
GetUserConfig() *UserConfig
GetUserConfigDir() string
GetUserConfigPath() string
+ GetTempDir() string
GetAppState() *AppState
SaveAppState() error
SetIsNewRepo(bool)
@@ -60,6 +62,8 @@ func NewAppConfig(name, version, commit, date string, buildSource string, debugg
debuggingFlag = true
}
+ tempDir := filepath.Join(os.TempDir(), "lazygit")
+
appState, err := loadAppState()
if err != nil {
return nil, err
@@ -75,6 +79,7 @@ func NewAppConfig(name, version, commit, date string, buildSource string, debugg
UserConfig: userConfig,
UserConfigDir: configDir,
UserConfigPath: filepath.Join(configDir, "config.yml"),
+ TempDir: tempDir,
AppState: appState,
IsNewRepo: false,
}
@@ -204,6 +209,10 @@ func (c *AppConfig) GetUserConfigDir() string {
return c.UserConfigDir
}
+func (c *AppConfig) GetTempDir() string {
+ return c.TempDir
+}
+
func (c *AppConfig) ReloadUserConfig() error {
userConfig, err := loadUserConfigWithDefaults(c.UserConfigDir)
if err != nil {