Permalink
Browse files

reload deck only if mtime says so

  • Loading branch information...
1 parent 02dbf78 commit 8fc3f5cb58a85980e4d8594a35dd2d57553f02de @fxn committed Sep 11, 2012
Showing with 10 additions and 5 deletions.
  1. +10 −5 bin/tkn
View
@@ -142,14 +142,19 @@ def read_command
end
end
-n = 0
+n = 0
+deck = ARGV[0]
+mtime = nil
+
loop do
print clear_screen
- # We load the presentation in every iteration to ease editing and reload.
- # This is fast enough, so who cares about caching.
- $slides = []
- load ARGV[0]
+ current_mtime = File.mtime(deck)
+ if mtime != current_mtime
+ $slides = []
+ load deck
+ mtime = current_mtime
+ end
n = [[0, n].max, $slides.length - 1].min
render($slides[n]).each_char do |c|

0 comments on commit 8fc3f5c

Please sign in to comment.