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} {
eebfe1f40f 2020-03-25 24: for {set i 0} {$i < 100000} {incr i} {
eebfe1f40f 2020-03-25 25: set filename [expr rand()]
eebfe1f40f 2020-03-25 26: ::xvfs::processFile $fsName "" $filename [dict create type file fileContents [expr rand()]]
eebfe1f40f 2020-03-25 27: lappend retval $filename
eebfe1f40f 2020-03-25 28: }
eebfe1f40f 2020-03-25 29:
eebfe1f40f 2020-03-25 30: dict set ::myOwnVFS "" children [list foo xvfs-create-synthetic {*}$retval]
eebfe1f40f 2020-03-25 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: }
eebfe1f40f 2020-03-25 39: lappend retval {*}[dict keys $::myOwnVFS]
eebfe1f40f 2020-03-25 40:
eebfe1f40f 2020-03-25 41: return $retval
c8742de968 2019-09-20 42: }
c8742de968 2019-09-20 43:
c8742de968 2019-09-20 44: ::xvfs::run --directory [pwd] --name synthetic