Artifact [d0aa4cbe5c]

Artifact d0aa4cbe5cf6bb098a1e10e133a348223e380b71115326e13a5bf596ba8030d9:


#! /usr/bin/env tclsh

set sourceDirectory [file dirname [file normalize [info script]]]
lappend auto_path [file join $sourceDirectory lib]
package require xvfs

proc ::xvfs::callback::setOutputFileName {args} {
	return "/"
}

dict set ::myOwnVFS "" {
	type directory
	children {foo xvfs-create-synthetic}
}
dict set ::myOwnVFS "foo" {
	type file
	fileContents "abc"
}
dict set ::myOwnVFS "xvfs-create-synthetic" {
	type file
}

proc ::xvfs::callback::addOutputFiles {fsName} {
	for {set i 0} {$i < 100000} {incr i} {
		set filename [expr rand()]
		::xvfs::processFile $fsName "" $filename [dict create type file fileContents [expr rand()]]
		lappend retval $filename
	}

	dict set ::myOwnVFS "" children [list foo xvfs-create-synthetic {*}$retval]

	dict for {outputName fileContentsDict} $::myOwnVFS {
		set inputFile $outputName
		if {[dict exists $fileContentsDict inputFile]} {
			set inputFile [dict get $fileContentsDict inputFile]
		}
		::xvfs::processFile $fsName $inputFile $outputName $fileContentsDict
	}
	lappend retval {*}[dict keys $::myOwnVFS]

	return $retval
}

::xvfs::run --directory [pwd] --name synthetic