@@ -7,15 +7,12 @@ import (
7
7
"fmt"
8
8
"os/exec"
9
9
"os/user"
10
- "path"
11
- "path/filepath"
12
10
"regexp"
13
11
"runtime"
14
12
"strconv"
15
13
"strings"
16
14
"sync"
17
15
18
- "github.com/lima-vm/lima/pkg/ioutilx"
19
16
. "github.com/lima-vm/lima/pkg/must"
20
17
"github.com/lima-vm/lima/pkg/version/versionutil"
21
18
"github.com/sirupsen/logrus"
@@ -115,9 +112,8 @@ func LimaUser(limaVersion string, warn bool) *user.User {
115
112
warnings = append (warnings , warning )
116
113
limaUser .Username = fallbackUser
117
114
}
118
- if runtime .GOOS != "windows" {
119
- limaUser .HomeDir = "/home/{{.User}}.linux"
120
- } else {
115
+ limaUser .HomeDir = "/home/{{.User}}.linux"
116
+ if runtime .GOOS == "windows" {
121
117
idu , err := call ([]string {"id" , "-u" })
122
118
if err != nil {
123
119
logrus .Debug (err )
@@ -146,38 +142,6 @@ func LimaUser(limaVersion string, warn bool) *user.User {
146
142
warnings = append (warnings , warning )
147
143
limaUser .Gid = formatUidGid (gid )
148
144
}
149
- home , err := ioutilx .WindowsSubsystemPath (limaUser .HomeDir )
150
- if err != nil {
151
- logrus .Debug (err )
152
- } else {
153
- // Trim mount prefix within Subsystem
154
- // cygwin/msys2 cygpath could have prefix for drive mounts configured via /etc/fstab
155
- // wsl wslpath could have prefix for drive mounts configured via [automount] section in wsl.conf
156
- drivePath , err := ioutilx .WindowsSubsystemPath (filepath .VolumeName (limaUser .HomeDir ) + "/" )
157
- if err != nil {
158
- logrus .Debug (err )
159
- } else {
160
- prefix := path .Dir (strings .TrimSuffix (drivePath , "/" ))
161
- if prefix != "/" {
162
- home = strings .TrimPrefix (home , prefix )
163
- }
164
- home += ".linux"
165
- }
166
- }
167
- if home == "" {
168
- drive := filepath .VolumeName (limaUser .HomeDir )
169
- home = filepath .ToSlash (limaUser .HomeDir )
170
- // replace C: with /c
171
- prefix := strings .ToLower (fmt .Sprintf ("/%c" , drive [0 ]))
172
- home = strings .Replace (home , drive , prefix , 1 )
173
- home += ".linux"
174
- }
175
- if ! regexPath .MatchString (limaUser .HomeDir ) {
176
- warning := fmt .Sprintf ("local home %q is not a valid Linux path (must match %q); using %q home instead" ,
177
- limaUser .HomeDir , regexPath .String (), home )
178
- warnings = append (warnings , warning )
179
- limaUser .HomeDir = home
180
- }
181
145
}
182
146
})
183
147
if warn {
0 commit comments