PDA

View Full Version : Where did ;edit go?



Cephalopod
06-07-2010, 02:19 PM
Somehow, ;edit seems to have disappeared from the Lich distribution.

Here's my copy, in case anyone misses it:


#!/usr/bin/env ruby
# All this does is run notepad.exe or another text editor to edit a script.


#editor = "notepad.exe"
editor = "C:\\Program Files\\Notepad++\\notepad++.exe"
scriptfile = script.vars[1]

unless script
echo("Error! Syntax is: ;edit (name)")
exit
end

begin
unless File.exists?($script_dir + "#{script.vars[1]}.lic")
File.open($script_dir + "#{script.vars[1]}.lic","w") { |file| file.puts("# Skeleton Lich file") }
end
rescue
echo("There's been an error during creation of the skeleton script file: #{$!}")
exit
end

unless system("#{editor} " + "\"#{$script_dir + scriptfile}.lic\"")
echo("Unknown error launching your editor, aborting: #{$!}")
end