From d8d0d4686d15700e67a1ecbcec310ee55f3a16c5 Mon Sep 17 00:00:00 2001 From: David Roman Date: Wed, 16 Mar 2022 14:07:48 +0100 Subject: [PATCH] Only read env once when recording dirs --- pkg/gui/quitting.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/gui/quitting.go b/pkg/gui/quitting.go index eae68ea5f..d3beaf998 100644 --- a/pkg/gui/quitting.go +++ b/pkg/gui/quitting.go @@ -20,10 +20,11 @@ func (gui *Gui) recordCurrentDirectory() error { } func (gui *Gui) recordDirectory(dirName string) error { - if os.Getenv("LAZYGIT_NEW_DIR_FILE") == "" { + newDirFilePath := os.Getenv("LAZYGIT_NEW_DIR_FILE") + if newDirFilePath == "" { return nil } - return gui.OSCommand.CreateFileWithContent(os.Getenv("LAZYGIT_NEW_DIR_FILE"), dirName) + return gui.OSCommand.CreateFileWithContent(newDirFilePath, dirName) } func (gui *Gui) handleQuitWithoutChangingDirectory() error {