1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
const nsILocalFile = Components.interfaces.nsILocalFile;
var prefix = "";
function rename(source, newName)
{
try {
var sourceFile = Components.classes["@mozilla.org/file/local;1"].
createInstance(nsILocalFile);
sourceFile.initWithPath(source);
}
catch (e) {
dump("Could not create nsILocalFile\n");
}
try {
sourceFile.copyTo(null, newName);
}
catch (e) {
dump("error coping" + e + "\n");
}
}
function cp(source, dest, followLinks, newName)
{
try {
var sourceFile = Components.classes["@mozilla.org/file/local;1"].
createInstance(nsILocalFile);
sourceFile.initWithPath(source);
var destFile = Components.classes["@mozilla.org/file/local;1"].
createInstance(nsILocalFile);
destFile.initWithPath(dest);
}
catch (e) {
dump("Could not create nsILocalFile\n");
}
try {
if (! destFile.isDirectory())
{
dump("destination not a directory!\n");
return;
}
}
catch (e) {
dump("error accessing dest");
}
try {
if (followLinks)
{
sourceFile.copyToFollowingLinks(destFile, newName);
}
else
{
sourceFile.copyTo(destFile, newName);
}
}
catch (e) {
dump("error coping" + e + "\n");
}
}
function mv(source, dest, followLinks, newName)
{
try {
var sourceFile = Components.classes["@mozilla.org/file/local;1"].
createInstance(nsILocalFile);
sourceFile.initWithPath(source);
var destFile = Components.classes["@mozilla.org/file/local;1"].
createInstance(nsILocalFile);
destFile.initWithPath(dest);
}
catch (e) {
dump("Could not create nsILocalFile\n");
}
try {
if (! destFile.isDirectory())
{
dump("destination not a directory!\n");
return;
}
}
catch (e) {
dump("error accessing dest");
}
try {
if (followLinks)
{
sourceFile.moveToFollowingLinks(destFile, newName);
}
else
{
sourceFile.moveTo(destFile, newName);
}
}
catch (e) {
dump("error coping" + e + "\n");
}
}
|