# Copyright 2005 Kevin Reid, under the terms of the MIT X license # found at http://www.opensource.org/licenses/mit-license.html ................ root ? # value: ? .getPath() # value: "/" a directory ? def home := [interp.getProps()["e.home"]]; null a file in the directory ? def runeScriptFile := home["clrune"]; null check print ? def `` := E.toQuote(runeScriptFile); null ? runeScriptFile.getPath().replaceAll(homeFragment, "") # value: "//clrune" ? runeScriptFile.getPlatformPath().replaceAll(homeFragment, "") # value: "//clrune" ? runeScriptFile.getTwine().split("\n")[0] # value: "#!/bin/bash" directory listing ? for name ? (name !~ `.@_`) => subfile in home["jlib"] { > println(`$name ${E.toQuote(subfile).replaceAll(homeFragment, "")}`) } # stdout: parseEToSExpression.emaker /jlib/parseEToSExpression.emaker> # exists and getOpt ? home.exists() # value: true ? runeScriptFile.exists() # value: true ? home["nonexistent"].exists() # value: false ? home.getOpt("clrune").getPath() == runeScriptFile.getPath() # value: true ? [home.getOpt("nonexistent")] # value: [null] readOnly ? def roHome := home.readOnly(); null x ? E.toQuote(roHome).replaceAll(homeFragment, "") x # value: ">.readOnly()" ? roHome.exists() # value: true ? roHome.__respondsTo("setText", 1) # value: false createNewFile, setText safety: if this file does not exist, the rest cannot access it because the variable isn't bound ' ? def writable ? !writable.exists() := home[`fileAccessTestFile-${timer.now()}`]; null ? [writable.createNewFile(null), writable.exists(), writable.getText()] # value: [null, true, ""] ? writable.setText("hi") ? writable.getText() # value: "hi" ? writable.delete(null) ? writable.exists() # value: false ? writable.setText("bye") ? writable.getText() # value: "bye" ? writable.delete(null) XXX all file operations all dir operations path construction is independent of current filesystem state readOnly is properly transitive