Permalink
Browse files

delete program link if exists

  • Loading branch information...
cadorn committed Aug 23, 2011
1 parent ab2748e commit 5001028bcd6fd8aae156966a501ed8466754fd1d
Showing with 14 additions and 13 deletions.
  1. +14 −13 lib/pinf-loader-js/loader.js
@@ -286,23 +286,24 @@ var boot = exports.boot = function(options)
if (!API.FILE.exists(pinfPackagesPath)) {
pinfPackagesPath = path.substring(0, path.length-13) + "/.pinf-packages";
}
-
- downloader.basePath = pinfPackagesPath;
-
-
+
+ downloader.basePath = pinfPackagesPath;
+
+
if (cliOptions["link-program-to"])
{
- if (!API.FILE.exists(cliOptions["link-program-to"]))
+ if (API.FILE.exists(cliOptions["link-program-to"]))
{
- if (!API.FILE.exists(API.FILE.dirname(cliOptions["link-program-to"])))
- API.FILE.mkdirs(API.FILE.dirname(cliOptions["link-program-to"]), 0775);
+ API.FILE.remove(cliOptions["link-program-to"]);
+ } else
+ if (!API.FILE.exists(API.FILE.dirname(cliOptions["link-program-to"])))
+ API.FILE.mkdirs(API.FILE.dirname(cliOptions["link-program-to"]), 0775);
- API.SYSTEM.exec("ln -s " + API.FILE.dirname(path) + " " + cliOptions["link-program-to"], function(stdout, stderr)
- {
- console.log(stdout);
- console.log(stderr);
- });
- }
+ API.SYSTEM.exec("ln -s " + API.FILE.dirname(path) + " " + cliOptions["link-program-to"], function(stdout, stderr)
+ {
+ console.log(stdout);
+ console.log(stderr);
+ });
}

0 comments on commit 5001028

Please sign in to comment.