|
1 const Cc = Components.classes; |
|
2 const Ci = Components.interfaces; |
|
3 |
|
4 function run_test() { |
|
5 // skip this test on Windows |
|
6 var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes); |
|
7 if (!isWindows) { |
|
8 var testDir = __LOCATION__.parent; |
|
9 // create a test file, then symlink it, then check that we think it's a symlink |
|
10 var targetFile = testDir.clone(); |
|
11 targetFile.append("target.txt"); |
|
12 if (!targetFile.exists()) |
|
13 targetFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0644); |
|
14 |
|
15 var link = testDir.clone(); |
|
16 link.append("link"); |
|
17 if (link.exists()) |
|
18 link.remove(false); |
|
19 |
|
20 var ln = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile); |
|
21 ln.initWithPath("/bin/ln"); |
|
22 var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess); |
|
23 process.init(ln); |
|
24 var args = ["-s", targetFile.path, link.path]; |
|
25 process.run(true, args, args.length); |
|
26 do_check_true(link.isSymlink()); |
|
27 } |
|
28 } |