From a0de7f95bc7525b99b2c2e16f566e0ee367e9c3c Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 9 May 2009 00:00:00 +0200 Subject: lots of changes. version 0.2.1 --- fm | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'fm') diff --git a/fm b/fm index 1129a9d4..5aa8bae3 100755 --- a/fm +++ b/fm @@ -8,6 +8,7 @@ LOG_LEVEL = 3 #LOG_LEVEL = 0 + def File::resolve_symlink( path = __FILE__ ) path = readlink(path) while symlink?(path) expand_path(path) @@ -17,30 +18,57 @@ def require_from_here ( *list ) require File.join( FM_DIR, *list ) end +def fj( *args ) File.join( *args ) end + $: << FM_DIR = File::dirname(File::resolve_symlink) +#SCREENSAVER = fj FM_DIR, 'code', 'screensaver', 'clock.rb' + PID = Process.pid if ARGV.size > 0 + case ARGV.first + when '-k' + exec "killall -9 fm" + end pwd = ARGV.first if pwd =~ /^file:\/\// pwd = $' end + + unless File.exists?(pwd) + pwd = nil + end + else pwd = nil end #require 'ftools' require 'pp' +require 'ostruct' +class OpenStruct; def __table__() @table end end require 'thread' require_from_here 'interface/ncurses.rb' +require_from_here 'code/extensions/basic.rb' +require_from_here 'code/extensions/fileutils.rb' require_from_here 'code/fm.rb' require_from_here 'code/keys.rb' require_from_here 'code/types.rb' +require_from_here 'code/bars.rb' +require_from_here 'code/action.rb' require_from_here 'code/draw.rb' -require_from_here 'code/extensions.rb' +require_from_here 'code/directory.rb' require_from_here 'code/debug.rb' + +# Screensaver +require_from_here 'code/screensaver/clock.rb' + +unless ARGV.empty? or File.directory?(pwd) + exec(Fm.getfilehandler_frompath(pwd)) +end + include Interface include Debug @@ -59,10 +87,13 @@ begin Fm.initialize( pwd ) Fm.main_loop ensure - closei + log "exiting!" + log "" + closei if Interface.running? Fm.dump ERROR_STREAM.close + # Kill all other threads for thr in Thread.list unless thr == Thread.current thr.kill -- cgit 1.4.1-2-gfad0