Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2008-04-24 18:35:46 -0400
committerAndrew Niefer2008-04-24 18:35:46 -0400
commitf36bb3051c7c2ddcd0459ff685452af6020234d1 (patch)
treeaa77aab597fd93c701110994634f1ee0d1ecc775 /bundles
parenta91e062fc820103938f67237b3d8701cfec40a19 (diff)
downloadrt.equinox.p2-f36bb3051c7c2ddcd0459ff685452af6020234d1.tar.gz
rt.equinox.p2-f36bb3051c7c2ddcd0459ff685452af6020234d1.tar.xz
rt.equinox.p2-f36bb3051c7c2ddcd0459ff685452af6020234d1.zip
bug 222621 - add force to ln action
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java9
3 files changed, 12 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java
index 0ebd72600..e3927fb29 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java
@@ -32,6 +32,7 @@ public class ActionConstants {
public static final String PARM_PATH = "path"; //$NON-NLS-1$
public static final String PARM_TARGET_DIR = "targetDir"; //$NON-NLS-1$
public static final String PARM_LINK_NAME = "linkName"; //$NON-NLS-1$
+ public static final String PARM_LINK_FORCE = "force"; //$NON-NLS-1$
public static final String PARM_LINK_TARGET = "linkTarget"; //$NON-NLS-1$
public static final String PARM_TARGET_FILE = "targetFile"; //$NON-NLS-1$
public static final String PARM_PERMISSIONS = "permissions"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java
index ec09404d5..17a49e296 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java
@@ -44,7 +44,9 @@ public class LinkAction extends ProvisioningAction {
if (linkName == null)
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_LINK_NAME, ID));
- ln(targetDir, linkTarget, linkName);
+ String force = (String) parameters.get(ActionConstants.PARM_LINK_FORCE);
+
+ ln(targetDir, linkTarget, linkName, Boolean.valueOf(force).booleanValue());
return Status.OK_STATUS;
}
@@ -53,10 +55,10 @@ public class LinkAction extends ProvisioningAction {
return null;
}
- private void ln(String targetDir, String linkTarget, String linkName) {
+ private void ln(String targetDir, String linkTarget, String linkName, boolean force) {
Runtime r = Runtime.getRuntime();
try {
- r.exec(new String[] {"ln", "-s", linkTarget, targetDir + IPath.SEPARATOR + linkName}); //$NON-NLS-1$ //$NON-NLS-2$
+ r.exec(new String[] {"ln", "-s" + (force ? "f" : ""), linkTarget, targetDir + IPath.SEPARATOR + linkName}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java
index 53cd67e92..77613d257 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java
@@ -21,6 +21,7 @@ public class LinkAction extends ProvisioningAction {
public static final String PARM_TARGET_DIR = "targetDir"; //$NON-NLS-1$
public static final String PARM_LINK_NAME = "linkName"; //$NON-NLS-1$
public static final String PARM_LINK_TARGET = "linkTarget"; //$NON-NLS-1$
+ public static final String PARM_LINK_FORCE = "force"; //$NON-NLS-1$
public IStatus execute(Map parameters) {
String targetDir = (String) parameters.get(PARM_TARGET_DIR);
@@ -35,7 +36,9 @@ public class LinkAction extends ProvisioningAction {
if (linkName == null)
return Util.errorStatus(NLS.bind(Messages.param_not_set, PARM_LINK_NAME, ID), null);
- ln(targetDir, linkTarget, linkName);
+ String force = (String) parameters.get(PARM_LINK_FORCE);
+
+ ln(targetDir, linkTarget, linkName, Boolean.valueOf(force).booleanValue());
return Status.OK_STATUS;
}
@@ -44,10 +47,10 @@ public class LinkAction extends ProvisioningAction {
return null;
}
- private void ln(String targetDir, String linkTarget, String linkName) {
+ private void ln(String targetDir, String linkTarget, String linkName, boolean force) {
Runtime r = Runtime.getRuntime();
try {
- r.exec(new String[] {"ln", "-s", linkTarget, targetDir + IPath.SEPARATOR + linkName}); //$NON-NLS-1$ //$NON-NLS-2$
+ r.exec(new String[] {"ln", "-s" + (force ? "f" : ""), linkTarget, targetDir + IPath.SEPARATOR + linkName}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();

Back to the top