Skip to content

Commit 080fe8d

Browse files
committed
Improves copy
1 parent 05dfa85 commit 080fe8d

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/nimblepkg/tools.nim

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,20 @@ proc changeRoot*(origRoot, newRoot, path: string): string =
134134
proc copyFileD*(fro, to: string): string =
135135
## Returns the destination (``to``).
136136
display("Copying", "file $# to $#" % [fro, to], priority = LowPriority)
137-
copyFileWithPermissions(fro, to)
138-
result = to
137+
try:
138+
copyFileWithPermissions(fro, to)
139+
result = to
140+
except OSError as e:
141+
# Try to copy without preserving permissions for files with restrictive permissions
142+
# This can happen with .git pack files
143+
try:
144+
copyFile(fro, to)
145+
result = to
146+
except OSError:
147+
# If we still can't copy, skip with a warning but don't fail the entire operation
148+
# This allows installation to continue even if some .git metadata files can't be copied
149+
display("Warning", "Skipped file $# (permission denied)" % fro, priority = LowPriority)
150+
result = to # Return the destination path even if copy failed
139151

140152
proc copyDirD*(fro, to: string): seq[string] =
141153
## Returns the filenames of the files in the directory that were copied.

src/nimblepkg/version.nim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ proc getSimpleString*(verRange: VersionRange): string =
353353
case verRange.kind
354354
of verSpecial:
355355
result = $verRange.spe
356-
# Remove '#' prefix for directory names (can cause issues with shell commands)
357356
if result.startsWith("#"):
358357
result = result[1..^1]
359358
of verLater, verEarlier, verEqLater, verEqEarlier, verEq:

0 commit comments

Comments
 (0)