Skip to content

Commit cd173c7

Browse files
committed
refactor: use os.fileNewer instead of comparing file mod times manually
Signed-off-by: Christopher Arndt <[email protected]>
1 parent 66c5acb commit cd173c7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/choosenim.nim

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright (C) Dominik Picheta. All rights reserved.
22
# BSD-3-Clause License. Look at license.txt for more info.
3-
import os, strutils, algorithm
3+
import std/[os, strutils, algorithm]
44

55
import nimblepkg/[cli, version]
66
import nimblepkg/common as nimbleCommon
@@ -98,8 +98,7 @@ proc chooseVersion(version: string, params: CliParams) =
9898
for kind, path in walkDir(tempDir, relative = true):
9999
if kind == pcFile:
100100
try:
101-
if not fileExists(binDir / path) or
102-
getLastModificationTime(binDir / path) < getLastModificationTime(tempDir / path):
101+
if not fileExists(binDir / path) or fileNewer(tempDir / path, binDir / path):
103102
moveFile(tempDir / path, binDir / path)
104103
display("Info:", "Copied '$1' to '$2'" % [path, binDir], priority = HighPriority)
105104
except:

0 commit comments

Comments
 (0)