/usr/share/savi/tcl/save.tcl is in savi 1.4.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | #
######################################################
#
# SaVi by Lloyd Wood (lloydwood@users.sourceforge.net),
# Patrick Worfolk (worfolk@alum.mit.edu) and
# Robert Thurman.
#
# Copyright (c) 1997 by The Geometry Center.
# Also Copyright (c) 2013 by Lloyd Wood.
#
# This file is part of SaVi. SaVi is free software;
# you can redistribute it and/or modify it only under
# the terms given in the file COPYRIGHT which you should
# have received along with this file. SaVi may be
# obtained from:
# http://savi.sourceforge.net/
# http://www.geom.uiuc.edu/locate/SaVi
#
######################################################
#
# save.tcl
#
# $Id: save.tcl,v 1.26 2013/05/05 05:19:26 lloydwood Exp $
proc save(build) {} {
global last_filename
set types {
{"SaVi simulation scripts" {.tcl} }
}
set filenotfound 1
while {$filenotfound == 1} {
set filename [tk_getSaveFile -filetypes $types \
-title "SaVi: save satellites" ]
if {"$filename" == ""} return
set filename [save(extension) "$filename" "tcl"]
# are we overwriting a file that adding the extension didn't catch?
if {[file exists $filename]} {
puts stderr "\nSaVi: Not saved! $filename already exists!"
} else {
set filenotfound 0
}
}
# open file
set f [open "$filename" w]
if {$f == ""} {
puts stderr "\nSaVi: couldn't save satellites to $filename"
return
}
puts $f "\# SaVi saved satellites"
puts $f "\# http://savi.sourceforge.net/"
set n [.main.cmd.lb size]
# put a wrapper around satellite creation
puts $f "satellites GV_BEGIN"
# write satellites
# skip 0, as that's sunlight
for {set i 1} {$i <= $n} {incr i} {
set noe [satellites GET $i]
puts -nonewline $f "satellites LOAD "
puts $f $noe
}
puts $f "\# satellite names, if any, follow."
for {set i 1} {$i <= $n} {incr i} {
set noe [satellites GET_NAME $i]
if {$noe != ""} {
puts $f "satellites NAME $i {$noe}"
}
}
# close file
puts $f "satellites GV_END"
close $f
puts stderr "\nSaVi: saved satellites to $filename"
set last_filename "$filename"
main(title) "$filename"
}
proc save(extension) {filename extension} {
if {[string last "$extension" ".$filename"] < 0} {
return "$filename.$extension"
} else {
return "$filename"
}
}
|