Skip to content
Permalink
Browse files
Add reflect_pull('dir')
  • Loading branch information
LadyCailin committed Apr 25, 2020
1 parent b733ab3 commit 87341338446a1c70e5f198799b395b3c970f8b31
Showing 1 changed file with 15 additions and 0 deletions.
@@ -124,6 +124,10 @@ public String docs() {
+ "|\n"
+ "| The absolute path to the current file\n"
+ "|-\n"
+ "| dir\n"
+ "|\n"
+ "| The absolute path to the directory that the current file is in\n"
+ "|-\n"
+ "| col\n"
+ "|\n"
+ "| The current column number\n"
@@ -195,6 +199,17 @@ public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntime
throw new CREIOException(ex.getMessage(), t);
}
}
} else if("dir".equalsIgnoreCase(param)) {
if(t.file() == null) {
return new CString("Unknown (maybe the interpreter?)", t);
} else {
try {
String dir = t.file().getParentFile().getCanonicalPath().replace('\\', '/');
return new CString(dir, t);
} catch (IOException ex) {
throw new CREIOException(ex.getMessage(), t);
}
}
} else if("col".equalsIgnoreCase(param)) {
return new CInt(t.col(), t);
} else if("datasources".equalsIgnoreCase(param)) {

0 comments on commit 8734133

Please sign in to comment.