Commit 1b83bbdb authored by Niels Bunkenburg's avatar Niels Bunkenburg

Replace copyFile with renameFile to avoid encoding errors #56

parent 8f87649b
......@@ -38,7 +38,7 @@ untarPackage :: String -> String -> IO ()
untarPackage tmpdir tarpath = do
-- Unpack tar.gz
createDirectoryIfMissing True tmpdir
(rc, _, stderr) <- evalCmd "tar" ["xzf", tarpath, "-C" ++ tmpdir, "-m", "--no-overwrite-dir"] ""
(rc, _, stderr) <- evalCmd "tar" ["-xzf", tarpath, "-C" ++ tmpdir, "-m", "--no-overwrite-dir"] ""
if rc /= 0
then fail $ "Unable to untar\n" ++ stderr
else done
......@@ -67,7 +67,7 @@ handleUploadNewPackageTarGz userid tarpath = do
renameDirectory dirname ("packages" </> name </> version)
-- Move tar file to package store
createDirectoryIfMissing True "packagestore"
copyFile tarpath ("packagestore" </> name ++ "-" ++ version ++ ".tar.gz")
renameFile tarpath ("packagestore" </> name ++ "-" ++ version ++ ".tar.gz")
if userTrusted user
then updatePackageIndex
else updateStagingPackageIndex
......@@ -102,13 +102,14 @@ importMultiplePackages paths = do
[] -> done
(x:xs) -> do
mapM_ (\(p, path, tarpath) -> do
(_, _) <- createPackage p
createPackage p
(name, version) <- handleUploadNewPackage Nothing (path </> "package.json")
createDirectoryIfMissing True ("packages" </> name </> version)
renameDirectory path ("packages" </> name </> version)
-- Move tar file to package store
createDirectoryIfMissing True "packagestore"
copyFile tarpath ("packagestore" </> name ++ "-" ++ version ++ ".tar.gz")) x
let dest = "packagestore" </> name ++ "-" ++ version ++ ".tar.gz"
renameFile tarpath dest) x
importOrder xs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment