code/superant.com.rwdtinkerbackwindow/initiateapplets.rb in bigtinker-0.95 vs code/superant.com.rwdtinkerbackwindow/initiateapplets.rb in bigtinker-0.96
- old
+ new
@@ -26,34 +26,37 @@
# integrate the new configuration files
def initiateapplet(nametextlocal)
debuginitiate = 0
- if $DEBUG
- $stderr.puts "starting config load with: #{nametextlocal}"
- end
+ $rwdtinkerlog.info "initiateapplet: starting config load with: #{nametextlocal}"
+
Dir.chdir($progdir ) #changes the current working directory
@confignew = "configuration/" + "#{nametextlocal}.cnf"
@configdist = "configuration/" + "#{nametextlocal}.dist"
Rconftool::install(@configdist,@confignew)
+
begin
+
configfileload = File.open(@configdist){|f| f.read}
+
eval configfileload #load config file
+
rescue
-
- if $DEBUG
- $stderr.puts "error in initiateapplets - config load"
- end
+
+ $rwdtinkerlog.error "initiateapplet: error in initiateapplets - config load"
+
+
debuginitiate += 1
end
$tempdoc = " "
Dir.chdir($progdir) # change back to top program directory
@@ -176,55 +179,57 @@
$rwd_gui_tinker = $tempdoc
rescue
$rwd_gui_tinker = tempguistorage # restore old gui
- if $DEBUG
- $stderr.puts "error in initiateapplets - gui building"
- end
+
+ $rwdtinkerlog.error "error in initiateapplets - gui building"
+
debuginitiate += 1
end
begin # error trap
-# now load in the code files
+ # now load in the code files
-$tempdoc = ""
-tempcodeinstallline = ""
+ $tempdoc = ""
+ tempcodeinstallline = ""
- @fileName = "installed/" + nametextlocal + ".inf"
+ @fileName = "installed/" + nametextlocal + ".inf"
+
+ $rwdtinkerlog.debug "initateapplets: loading file: #{@fileName}"
- tmpfilearray = File.readlines(@fileName)
+ tmpfilearray = File.readlines(@fileName)
- tmpfilearray.each do |line|
+ tmpfilearray.each do |line|
- tempcodeinstallline = line.chomp
- if tempcodeinstallline.include?('code/')
- findfiles(tempcodeinstallline + "/**")
- tempcoderesult = eval( $tempdoc ) # read the program code and evaluate
- end
-end
+ tempcodeinstallline = line.chomp
+ if tempcodeinstallline.include?('code/')
+ findfiles(tempcodeinstallline + "/**")
+ tempcoderesult = eval( $tempdoc ) # read the program code and evaluate
+ end
+ end
rescue
- if $DEBUG
- $stderr.puts "error in initiateapplets - code building"
- end
+
+ $rwdtinkerlog.error "error in initiateapplets - code building"
+
debuginitiate += 1
end
- setuphelpaboutoptions # update the help about list
- setuptinkerdocuments # update the document pull down list
- runhelpwindow # update the help menu
- showjumplinkoptions # update the application link menu
- runrwdtinkerbackwindow # back to applet window
+ setuphelpaboutoptions # update the help about list
+ setuptinkerdocuments # update the document pull down list
+ runhelpwindow # update the help menu
+ showjumplinkoptions # update the application link menu
+ runrwdtinkerbackwindow # back to applet window
- # resultend = tempcodeinstallline .index("\n",resultstart)
- tempresult = @fileName
+ # resultend = tempcodeinstallline .index("\n",resultstart)
+ tempresult = @fileName
-return " applet loading successful " + tempresult
+ return " applet loading successful " + tempresult
if debuginitiate > 0
return " initiateapplet .."