c8742de968 2019-09-20 1: #! /usr/bin/env tclsh
c8742de968 2019-09-20 2:
c8742de968 2019-09-20 3: set sourceDirectory [file dirname [file normalize [info script]]]
c8742de968 2019-09-20 4: lappend auto_path [file join $sourceDirectory lib]
c8742de968 2019-09-20 5: package require xvfs
c8742de968 2019-09-20 6:
c8742de968 2019-09-20 7: proc ::xvfs::callback::setOutputFileName {args} {
c8742de968 2019-09-20 8: return "/"
c8742de968 2019-09-20 9: }
c8742de968 2019-09-20 10:
fc90ef3457 2019-09-20 11: dict set ::myOwnVFS "" {
fc90ef3457 2019-09-20 12: type directory
fc90ef3457 2019-09-20 13: children {foo xvfs-create-synthetic}
fc90ef3457 2019-09-20 14: }
fc90ef3457 2019-09-20 15: dict set ::myOwnVFS "foo" {
fc90ef3457 2019-09-20 16: type file
fc90ef3457 2019-09-20 17: fileContents "abc"
fc90ef3457 2019-09-20 18: }
fc90ef3457 2019-09-20 19: dict set ::myOwnVFS "xvfs-create-synthetic" {
fc90ef3457 2019-09-20 20: type file
fc90ef3457 2019-09-20 21: }
fc90ef3457 2019-09-20 22:
c8742de968 2019-09-20 23: proc ::xvfs::callback::addOutputFiles {fsName} {
9f07de5ec5 2019-12-02 24: for {set i 0} {$i < 100000} {incr i} {
9f07de5ec5 2019-12-02 25: set filename [expr rand()]
9f07de5ec5 2019-12-02 26: ::xvfs::processFile $fsName "" $filename [dict create type file fileContents [expr rand()]]
9f07de5ec5 2019-12-02 27: lappend retval $filename
9f07de5ec5 2019-12-02 28: }
9f07de5ec5 2019-12-02 29:
9f07de5ec5 2019-12-02 30: dict set ::myOwnVFS "" children [list foo xvfs-create-synthetic {*}$retval]
9f07de5ec5 2019-12-02 31:
fc90ef3457 2019-09-20 32: dict for {outputName fileContentsDict} $::myOwnVFS {
fc90ef3457 2019-09-20 33: set inputFile $outputName
fc90ef3457 2019-09-20 34: if {[dict exists $fileContentsDict inputFile]} {
fc90ef3457 2019-09-20 35: set inputFile [dict get $fileContentsDict inputFile]
fc90ef3457 2019-09-20 36: }
fc90ef3457 2019-09-20 37: ::xvfs::processFile $fsName $inputFile $outputName $fileContentsDict
fc90ef3457 2019-09-20 38: }
9f07de5ec5 2019-12-02 39: lappend retval {*}[dict keys $::myOwnVFS]
9f07de5ec5 2019-12-02 40:
9f07de5ec5 2019-12-02 41: return $retval
c8742de968 2019-09-20 42: }
c8742de968 2019-09-20 43:
c8742de968 2019-09-20 44: ::xvfs::run --directory [pwd] --name synthetic