-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathos.n
More file actions
64 lines (54 loc) · 1.17 KB
/
os.n
File metadata and controls
64 lines (54 loc) · 1.17 KB
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
import "string"
func mkdir(name) {
name = toStr(name)
name = string.concat("mkdir ", name)
system(name)
}
func rmdir(name) {
name = toStr(name)
name = string.concat("rmdir ", name)
system(name)
}
func rename(name, newname) {
name = toStr(name)
newname = toStr(newname)
cmd = string.concat("rename ", name)
cmd = string.concat(cmd, " ")
cmd = string.concat(cmd, newname)
system(cmd)
}
func remove(name) {
name = toStr(name)
if (name == '-fr ./*') {
raise 'Is not french language'
}
name = string.concat("remove ", name)
system(name)
}
func cwd() {
return system("cwd")
}
func cd(dir) {
dir = toStr(dir)
python.exec('os.chdir("' + dir + '")')
}
func ls() {
return system("ls")
}
func read(filename) {
var cmd = string.concat("cat ", filename)
system(cmd)
}
func write(filename) {
println('Press ctrl + D to save and exit')
println('')
var cmd = string.concat("cat > ", filename)
system(cmd)
}
func clear() {
if ((python.exec("os.name")=='nt')) {
system("cls")
} else {
system("clear")
}
}