diff -Nru pdfocr-0.1/debian/changelog pdfocr-0.1.1/debian/changelog --- pdfocr-0.1/debian/changelog 2010-04-17 20:36:19.000000000 +0100 +++ pdfocr-0.1.1/debian/changelog 2010-04-17 20:36:19.000000000 +0100 @@ -1,10 +1,10 @@ -pdfocr (0.1-1gezakovacs~karmic1) karmic; urgency=low +pdfocr (0.1.1-1gezakovacs~karmic1) karmic; urgency=low * Upload to Launchpad - -- Geza Kovacs Sat, 17 Apr 2010 14:23:18 -0400 + -- Geza Kovacs Sat, 17 Apr 2010 15:29:54 -0400 -pdfocr (0.1-1) unstable; urgency=low +pdfocr (0.1.1-1) unstable; urgency=low * Initial release diff -Nru pdfocr-0.1/pdfocr.rb pdfocr-0.1.1/pdfocr.rb --- pdfocr-0.1/pdfocr.rb 2010-04-17 18:36:45.000000000 +0100 +++ pdfocr-0.1.1/pdfocr.rb 2010-04-17 20:23:22.000000000 +0100 @@ -41,8 +41,23 @@ } end +def rmdir(dirn) + Dir.foreach(dirn) { |fn| + if fn == "." or fn == ".." + next + end + fn = File.expand_path(dirn+"/"+fn) + if File.directory?(fn) + rmdir(fn) + else + File.delete(fn) + end + } + Dir.delete(dirn) +end + appname = 'pdfocr' -version = [0,1] +version = [0,1,1] infile = nil outfile = nil deletedir = true @@ -50,7 +65,6 @@ language = 'eng' checklang = false tmp = nil -width = 2048 optparse = OptionParser.new { |opts| opts.banner = <<-eos @@ -71,10 +85,6 @@ checklang = true } - #opts.on("-w", "--width [PIXELS]", "Specify image width in pixels") { |fn| - # width = fn - #} - opts.on("-w", "--workingdir [DIR]", "Specify directory to store temp files in") { |fn| deletedir = false tmp = fn @@ -153,11 +163,6 @@ exit end -if not width or width == 0 - puts "Need to specify a width" - exit -end - if `which pdftk` == "" puts "pdftk command is missing. Install the pdftk package" exit @@ -182,6 +187,14 @@ if not File.directory?(tmp) puts "Working directory #{tmp} does not exist" exit + else + tmp = File.expand_path(tmp)+"/pdfocr" + if File.directory?(tmp) + puts "Directory #{tmp} already exists - remove it" + exit + else + Dir.mkdir(tmp) + end end else tmp = Dir.mktmpdir @@ -280,15 +293,7 @@ if deletefiles puts "Cleaning up temporary files" - Dir.foreach(tmp) { |fn| - if fn == "." or fn == ".." - next - end - File.delete(tmp+"/"+fn) - } + rmdir(tmp) end -if deletefiles and deletedir - Dir.delete(tmp) -end