95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
proc ::xvfs::processFile {fsName inputFile outputFile fileInfoDict} {
array set fileInfo $fileInfoDict
switch -exact -- $fileInfo(type) {
"file" {
set type "XVFS_FILE_TYPE_REG"
set fd [open $inputFile]
fconfigure $fd -encoding binary -translation binary -blocking true
set data [read $fd]
set size [string length $data]
set data [string trimleft [binaryToCHex $data "\t\t\t"]]
close $fd
}
"directory" {
set type "XVFS_FILE_TYPE_DIR"
set children $fileInfo(children)
set size [llength $children]
if {$size == 0} {
|
>
>
>
|
|
|
>
>
<
|
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
proc ::xvfs::processFile {fsName inputFile outputFile fileInfoDict} {
array set fileInfo $fileInfoDict
switch -exact -- $fileInfo(type) {
"file" {
set type "XVFS_FILE_TYPE_REG"
if {[info exists fileInfo(fileContents)]} {
set data $fileInfo(fileContents)
} else {
set fd [open $inputFile]
fconfigure $fd -encoding binary -translation binary -blocking true
set data [read $fd]
close $fd
}
set size [string length $data]
set data [string trimleft [binaryToCHex $data "\t\t\t"]]
}
"directory" {
set type "XVFS_FILE_TYPE_DIR"
set children $fileInfo(children)
set size [llength $children]
if {$size == 0} {
|
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
file stat $inputFile fileInfo
set fileInfo(children) $children
processFile $fsName $inputFile $outputFile [array get fileInfo]
lappend outputFiles $outputFile
if {$isTopLevel} {
::xvfs::_emitLine "\};"
}
return $outputFiles
}
proc ::xvfs::main {argv} {
|
>
>
>
>
|
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
file stat $inputFile fileInfo
set fileInfo(children) $children
processFile $fsName $inputFile $outputFile [array get fileInfo]
lappend outputFiles $outputFile
if {$isTopLevel} {
if {[info command ::xvfs::callback::addOutputFiles] ne ""} {
lappend outputFiles {*}[::xvfs::callback::addOutputFiles]
}
::xvfs::_emitLine "\};"
}
return $outputFiles
}
proc ::xvfs::main {argv} {
|