Skip to content

Commit 8057f1b

Browse files
committed
fix: Do not blindly append devbox.json, saving
When saving a file, do not blindly append devbox.json to the file path.
1 parent 19b0d20 commit 8057f1b

File tree

1 file changed

+7
-0
lines changed
  • internal/devconfig/configfile

1 file changed

+7
-0
lines changed

internal/devconfig/configfile/file.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ func (c *ConfigFile) InitHook() *shellcmd.Commands {
110110
// SaveTo writes the config to a file.
111111
func (c *ConfigFile) SaveTo(path string) error {
112112
return os.WriteFile(filepath.Join(path, DefaultName), c.Bytes(), 0o644)
113+
finalPath := path
114+
if filepath.Base(path) != DefaultName {
115+
finalPath = filepath.Join(path, DefaultName)
116+
}
117+
118+
//return os.WriteFile(filepath.Join(path, DefaultName), c.Bytes(), 0o644)
119+
return os.WriteFile(filepath.Join(finalPath), c.Bytes(), 0o644)
113120
}
114121

115122
// TODO: Can we remove SaveTo and just use Save()?

0 commit comments

Comments
 (0)