File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -46,11 +46,13 @@ export
46
46
GetEnv
47
47
PutEnv
48
48
49
- % File I/0
49
+ % Directories
50
50
GetDir
51
51
GetCWD
52
+ ChDir
52
53
Tmpnam
53
54
55
+ % File I/0
54
56
Fopen
55
57
Fread
56
58
Fwrite
@@ -136,6 +138,7 @@ define
136
138
end
137
139
138
140
GetCWD = Boot_OS.getCWD
141
+ ChDir = Boot_OS.chDir
139
142
Tmpnam = Boot_OS.tmpnam
140
143
141
144
fun {Fopen FileName Mode}
Original file line number Diff line number Diff line change @@ -280,6 +280,24 @@ public:
280
280
}
281
281
};
282
282
283
+ class ChDir : public Builtin <ChDir> {
284
+ public:
285
+ ChDir (): Builtin(" chDir" ) {}
286
+
287
+ static void call (VM vm, In dir) {
288
+ size_t dirBufSize = ozVSLengthForBuffer (vm, dir);
289
+ std::string dirStr;
290
+
291
+ ozVSGet (vm, dir, dirBufSize, dirStr);
292
+
293
+ boost::system::error_code ec;
294
+ boost::filesystem::current_path (dirStr, ec);
295
+ if (ec) {
296
+ raiseOSError (vm, " chdir" , ec);
297
+ }
298
+ }
299
+ };
300
+
283
301
class Tmpnam : public Builtin <Tmpnam> {
284
302
public:
285
303
Tmpnam (): Builtin(" tmpnam" ) {}
You can’t perform that action at this time.
0 commit comments