Skip to content

Commit

Permalink
kpkg: stop using mv and start using cp
Browse files Browse the repository at this point in the history
  • Loading branch information
kreatoo committed Sep 8, 2023
1 parent f917d65 commit 91b0b4b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
4 changes: 2 additions & 2 deletions kpkg/commands/installcmd.nim
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ proc install_pkg*(repo: string, package: string, root: string, built = false) =
createSymlink(package, root&"/var/cache/kpkg/installed/"&i)

if built:
mv("/tmp/kpkg/build", root)
cp("/tmp/kpkg/build", root)
else:
mv("/tmp/kpkg/extractDir", root)
cp("/tmp/kpkg/extractDir", root)

writeFile(root&"/var/cache/kpkg/installed/"&package&"/list_files", cmd.output)

Expand Down
6 changes: 3 additions & 3 deletions kpkg/modules/commonTasks.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ proc getInit*(root: string): string =
except CatchableError:
err("couldn't load "&root&"/etc/kreato-release")

proc mv*(f: string, t: string) =
proc cp*(f: string, t: string) =
## Moves files and directories.
var d: string

Expand All @@ -29,13 +29,13 @@ proc mv*(f: string, t: string) =

if dirExists(i) and not dirExists(t&"/"&i):
copyDirWithPermissions(i, t&"/"&i)
removeDir(i)

createDir(d)

if fileExists(i) or symlinkExists(i):
if fileExists(t&"/"&i):
removeFile(t&"/"&i)
copyFileWithPermissions(i, t&"/"&i)
removeDir(i)

proc printPackagesPrompt*(packages: string, yes: bool, no: bool) =
## Prints the packages summary prompt.
Expand Down
7 changes: 0 additions & 7 deletions kpkg/modules/dephandler.nim
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ import strutils
import runparser
import commonTasks

proc isIn(one: seq[string], two: seq[string]): bool =
## Checks if a variable is in another.
for i in one:
if i in two:
return true
return false

proc checkVersions(root: string, dependency: string, repo: string, split = @[
"<=", ">=", "<", ">", "="]): string =
## Internal proc for checking versions on dependencies (if it exists)
Expand Down

0 comments on commit 91b0b4b

Please sign in to comment.