1 module orelang.operator.PathOperators; 2 import orelang.operator.IOperator, 3 orelang.Engine, 4 orelang.Value; 5 6 /** 7 * path-exists 8 * path-is-dir 9 * path-is-file 10 */ 11 import std.file; 12 13 class PathExistsOperator : IOperator { 14 /** 15 * call 16 */ 17 public Value call(Engine engine, Value[] args) { 18 return new Value(engine.eval(args[0]).getString.exists); 19 } 20 } 21 22 class PathIsDirOperator : IOperator { 23 /** 24 * call 25 */ 26 public Value call(Engine engine, Value[] args) { 27 return new Value(engine.eval(args[0]).getString.isDir); 28 } 29 } 30 31 class PathIsFileOperator : IOperator { 32 /** 33 * call 34 */ 35 public Value call(Engine engine, Value[] args) { 36 return new Value(engine.eval(args[0]).getString.isFile); 37 } 38 }