23 lines
423 B
Lua
23 lines
423 B
Lua
local h = require('dep.helpers')
|
|
local logger = require('dep.log')
|
|
|
|
local fs = {}
|
|
|
|
function fs:sync(package, cb)
|
|
if not package.exists then
|
|
fs:link(package, cb)
|
|
end
|
|
end
|
|
|
|
function fs:link(package, cb)
|
|
h.uv.fs_symlink(package.path, package.dir, nil, function(err, _)
|
|
if err then
|
|
logger:log("error", "failed to symlink %s; reason: %s", package.id, err)
|
|
else
|
|
cb(err)
|
|
end
|
|
end)
|
|
end
|
|
|
|
return fs
|