Commit d1991c9e authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Fix bug on spaced files name

parent 564dfea2
......@@ -71,9 +71,9 @@ class Ln(val root: Configurable) extends InProcessFunction with Configurable {
if (relative) {
// workaround until we have `ln` that works with relative path (i.e. `ln -r`)
"ln -s " + inRelative + " " + outCanonical
"ln -s '" + inRelative + "' '" + outCanonical + "'"
} else {
"ln -s " + inCanonical + " " + outCanonical
"ln -s '" + inCanonical + "' '" + outCanonical + "'"
}
}
......
......@@ -18,7 +18,7 @@ class LnUnitTest {
ln.relative = true
ln.in = new File("/dir/nested/target.txt")
ln.out = new File("/dir/nested/link.txt")
Assert.assertEquals(ln.cmd, "ln -s target.txt /dir/nested/link.txt")
Assert.assertEquals(ln.cmd, "ln -s 'target.txt' '/dir/nested/link.txt'")
}
@Test(description = "Target is one level above link, relative set to true")
......@@ -27,7 +27,7 @@ class LnUnitTest {
ln.relative = true
ln.in = new File("/dir/target.txt")
ln.out = new File("/dir/nested/link.txt")
Assert.assertEquals(ln.cmd, "ln -s ../target.txt /dir/nested/link.txt")
Assert.assertEquals(ln.cmd, "ln -s '../target.txt' '/dir/nested/link.txt'")
}
@Test(description = "Target is two levels above link, relative set to true")
......@@ -36,7 +36,7 @@ class LnUnitTest {
ln.relative = true
ln.in = new File("/target.txt")
ln.out = new File("/dir/nested/link.txt")
Assert.assertEquals(ln.cmd, "ln -s ../../target.txt /dir/nested/link.txt")
Assert.assertEquals(ln.cmd, "ln -s '../../target.txt' '/dir/nested/link.txt'")
}
@Test(description = "Target is a child of a directory one level above link, relative set to true")
......@@ -45,7 +45,7 @@ class LnUnitTest {
ln.relative = true
ln.in = new File("/dir/another_nested/target.txt")
ln.out = new File("/dir/nested/link.txt")
Assert.assertEquals(ln.cmd, "ln -s ../another_nested/target.txt /dir/nested/link.txt")
Assert.assertEquals(ln.cmd, "ln -s '../another_nested/target.txt' '/dir/nested/link.txt'")
}
@Test(description = "Target is one level below link, relative set to true")
......@@ -54,7 +54,7 @@ class LnUnitTest {
ln.relative = true
ln.in = new File("/dir/nested/deeper/target.txt")
ln.out = new File("/dir/nested/link.txt")
Assert.assertEquals(ln.cmd, "ln -s deeper/target.txt /dir/nested/link.txt")
Assert.assertEquals(ln.cmd, "ln -s 'deeper/target.txt' '/dir/nested/link.txt'")
}
@Test(description = "Target is two levels below link, relative set to true")
......@@ -63,7 +63,7 @@ class LnUnitTest {
ln.relative = true
ln.in = new File("/dir/nested/even/deeper/target.txt")
ln.out = new File("/dir/nested/link.txt")
Assert.assertEquals(ln.cmd, "ln -s even/deeper/target.txt /dir/nested/link.txt")
Assert.assertEquals(ln.cmd, "ln -s 'even/deeper/target.txt' '/dir/nested/link.txt'")
}
@Test(description = "Relative set to false")
......@@ -72,7 +72,7 @@ class LnUnitTest {
ln.relative = false
ln.in = new File("/dir/nested/target.txt")
ln.out = new File("/dir/nested/link.txt")
Assert.assertEquals(ln.cmd, "ln -s /dir/nested/target.txt /dir/nested/link.txt")
Assert.assertEquals(ln.cmd, "ln -s '/dir/nested/target.txt' '/dir/nested/link.txt'")
}
// TODO: test for case where abosolute is true and input paths are relative?
......
Supports Markdown
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