lib/roby/app/scripts/results.rb in roby-0.8.0 vs lib/roby/app/scripts/results.rb in roby-3.0.0
- old
+ new
@@ -1,16 +1,25 @@
require 'roby'
require 'fileutils'
-Roby.app.setup
+Roby.app.load_base_config
app = Roby.app
-# Check there are actually files in the log/ directory
-if Dir.enum_for(:glob, File.join(app.log_dir, "*")).to_a.empty?
- puts "no files in #{app.log_dir}, nothing to do"
+if !(name = ARGV.shift)
+ STDERR.puts "calling 'results' with no arguments does nothing anymore"
exit 0
end
-user_path = ARGV.shift || ''
-final_path = Roby::Application.unique_dirname(Roby.app.results_dir, user_path)
-puts "moving #{app.log_dir} to #{final_path}"
-FileUtils.mv app.log_dir, final_path
+begin
+ src = Roby.app.log_current_dir
+rescue ArgumentError
+ STDERR.puts "no current log directory, nothing to do"
+ exit 0
+end
+
+dest = Roby::Application.unique_dirname(Roby.app.log_base_dir, name, Roby.app.log_read_time_tag)
+FileUtils.mv src, dest
+STDERR.puts "moved current log directory #{src}"
+STDERR.puts " to #{dest}"
+FileUtils.rm_f File.join(Roby.app.log_base_dir, "current")
+FileUtils.ln_sf dest, File.join(Roby.app.log_base_dir, "current")
+STDERR.puts "the symbolic link logs/current has been updated to the new location"