Skip to content

Commit 1cc5ddd

Browse files
authored
[plugins] remove extraneous code change from #1917 (#1937)
## Summary @mikeland73 pointed out that these lines are extraneous, and testing confirmed it. The real fix was the "/"+devboxHiddenDir+"/". Also changed to use `filepath.Separator` ## How was it tested? same test plan as #1917
1 parent 71413d1 commit 1cc5ddd

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

internal/plugin/plugin.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ import (
1616

1717
"github.com/pkg/errors"
1818
"github.com/tailscale/hujson"
19+
"go.jetpack.io/devbox/internal/debug"
1920
"go.jetpack.io/devbox/internal/devconfig/configfile"
2021
"go.jetpack.io/devbox/internal/devpkg"
21-
"go.jetpack.io/devbox/internal/fileutil"
22-
23-
"go.jetpack.io/devbox/internal/debug"
2422
"go.jetpack.io/devbox/internal/lock"
2523
"go.jetpack.io/devbox/internal/nix"
2624
"go.jetpack.io/devbox/internal/services"
@@ -229,20 +227,16 @@ func (m *Manager) shouldCreateFile(
229227
pkg *lock.Package,
230228
filePath string,
231229
) bool {
230+
sep := string(filepath.Separator)
231+
232232
// Only create files in devbox.d directory if they are not in the lockfile
233233
pluginInstalled := pkg != nil && pkg.PluginVersion != ""
234-
if strings.Contains(filePath, "/"+devboxDirName+"/") && pluginInstalled {
235-
return false
236-
}
237-
238-
// We do not overwrite an existing file in devbox.d. That is user-config that is user-controlled
239-
// after the initial file creation via the Devbox plugin.
240-
if strings.Contains(filePath, "/"+devboxDirName+"/") && fileutil.Exists(filePath) {
234+
if strings.Contains(filePath, sep+devboxDirName+sep) && pluginInstalled {
241235
return false
242236
}
243237

244238
// Hidden .devbox files are always replaceable, so ok to recreate
245-
if strings.Contains(filePath, "/"+devboxHiddenDirName+"/") {
239+
if strings.Contains(filePath, sep+devboxHiddenDirName+sep) {
246240
return true
247241
}
248242
_, err := os.Stat(filePath)

0 commit comments

Comments
 (0)