Skip to content

Commit ac22f7c

Browse files
committed
fixup: not compile on Windows
1 parent 86108de commit ac22f7c

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

lib/pure/os.nim

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -140,26 +140,27 @@ proc expandTilde*(path: string): string {.
140140
elif (path[1] in {DirSep, AltSep}):
141141
tryGetHomeOrRet
142142
result = result / path.substr(2)
143-
elif compiles(getHomeDir("bob")):
144-
# handle path beginning with `~bob` and `~bob/`
145-
# which means home of bob
146-
var i = path.find(DirSep, 1)
147-
if i < 0:
148-
i = len(path)
143+
else:
144+
when compiles(getHomeDir("bob")):
145+
# handle path beginning with `~bob` and `~bob/`
146+
# which means home of bob
147+
var i = path.find(DirSep, 1)
148+
if i < 0:
149+
i = len(path)
149150

150-
let
151-
name = path[1..<i]
152-
userhome = getHomeDir(name)
151+
let
152+
name = path[1..<i]
153+
userhome = getHomeDir(name)
153154

154-
if userhome == "" and hostOS == "vsworks":
155-
# XXX: As of the moment this line is written,
156-
# hostOS won't be "vsworks" yet.
157-
return path
155+
if userhome == "" and hostOS == "vsworks":
156+
# XXX: As of the moment this line is written,
157+
# hostOS won't be "vsworks" yet.
158+
return path
158159

159-
result = userhome & path.substr(i)
160+
result = userhome & path.substr(i)
160161

161-
else:
162-
result = path
162+
else:
163+
result = path
163164

164165
proc quoteShellWindows*(s: string): string {.noSideEffect, rtl, extern: "nosp$1".} =
165166
## Quote `s`, so it can be safely passed to Windows API.

0 commit comments

Comments
 (0)