Add three new native modules (fswatch, sysinfo, udp) to the Wren CLI build system and module registry. Extend the io module with async file copy and move operations using libuv uv_fs_copyfile and uv_fs_rename, plus expose stat mtime/atime/ctime fields and stdin windowSize. Update the io.wren wrapper with File.write, File.copy, File.move static methods and corresponding foreign declarations. Add shebang lines to generator2.wren, merge_all_wren.wren, merge_docs.wren, and phonebook.wren scripts.
34 lines
678 B
JavaScript
Executable File
Vendored
34 lines
678 B
JavaScript
Executable File
Vendored
#!/usr/local/bin/wren
|
|
|
|
import "io" for File, Directory
|
|
|
|
class WrenFileReader {
|
|
static listWrenFiles(dir) {
|
|
var files = []
|
|
var entries = Directory.list(dir)
|
|
for (entry in entries) {
|
|
var fullPath = "%(dir)/%(entry)"
|
|
if (Directory.exists(fullPath)) {
|
|
files.addAll(listWrenFiles(fullPath))
|
|
} else if (entry.endsWith(".wren")) {
|
|
files.add(fullPath)
|
|
}
|
|
}
|
|
return files
|
|
}
|
|
|
|
static readFiles(files) {
|
|
for (file in files) {
|
|
System.print("--- %(file) ---")
|
|
System.print(File.read(file))
|
|
}
|
|
}
|
|
|
|
static main() {
|
|
var wrenFiles = listWrenFiles(".")
|
|
readFiles(wrenFiles)
|
|
}
|
|
}
|
|
|
|
WrenFileReader.main()
|