@@ -152,7 +152,11 @@ func initShellBinaryFields(path string) *DevboxShell {
152
152
shell .userShellrcPath = rcfilePath (".bashrc" )
153
153
case "zsh" :
154
154
shell .name = shZsh
155
- shell .userShellrcPath = rcfilePath (".zshrc" )
155
+ if zdotdir := os .Getenv ("ZDOTDIR" ); zdotdir != "" {
156
+ shell .userShellrcPath = filepath .Join (os .ExpandEnv (zdotdir ), ".zshrc" )
157
+ } else {
158
+ shell .userShellrcPath = rcfilePath (".zshrc" )
159
+ }
156
160
case "ksh" :
157
161
shell .name = shKsh
158
162
shell .userShellrcPath = rcfilePath (".kshrc" )
@@ -365,6 +369,7 @@ func (s *DevboxShell) linkShellStartupFiles(shellSettingsDir string) {
365
369
filenames = append (filenames , ".zimrc" )
366
370
367
371
for _ , filename := range filenames {
372
+ // The userShellrcPath should be set to ZDOTDIR already.
368
373
fileOld := filepath .Join (filepath .Dir (s .userShellrcPath ), filename )
369
374
_ , err := os .Stat (fileOld )
370
375
if errors .Is (err , fs .ErrNotExist ) {
@@ -376,12 +381,11 @@ func (s *DevboxShell) linkShellStartupFiles(shellSettingsDir string) {
376
381
}
377
382
378
383
fileNew := filepath .Join (shellSettingsDir , filename )
379
-
380
- if err := os .Link (fileOld , fileNew ); err == nil {
381
- debug .Log ("Linked shell startup file %s to %s" , fileOld , fileNew )
382
- } else {
384
+ cmd := exec .Command ("cp" , fileOld , fileNew )
385
+ if err := cmd .Run (); err != nil {
383
386
// This is a best-effort operation. If there's an error then log it for visibility but continue.
384
- debug .Log ("Error linking zsh setting file from %s to %s: %v" , fileOld , fileNew , err )
387
+ debug .Log ("Error copying zsh setting file from %s to %s: %v" , fileOld , fileNew , err )
388
+ continue
385
389
}
386
390
}
387
391
}
0 commit comments