#!/usr/bin/env ruby require "qte" require "qpe" include Qte include Qpe class MainWindow < QMainWindow def initialize super self.setCaption(tr("EBtLog2HTML")) @label = QLabel.new(tr("保存先はebtのログの場所から一個上がって./ebt_html"),self) @label4= QLabel.new(tr("↓ebtのログの場所"),self) @qstn3=QLineEdit.new(tr("/mnt/cf/ebt/"),self) @myb01=QPushButton.new(tr("save"),self) connect(@myb01,QSIGNAL("clicked()"),self,'run') @label.setGeometry(15, 105, 580, 30) @label4.setGeometry(15, 185, 580, 30) @qstn3.setGeometry(15, 295, 290, 40) @myb01.setGeometry(305, 295, 290, 40) end def myselect dlg = UkFileDialog.new(self,"/home/zaurus/Documents/", 0, "フォルダの選択") res = dlg.exec() if (res == QDialog::Accepted) filePath = dlg.filePath() end end def run @ss=@qstn3.text().utf8().to_str() if @ss[-1,1]!="/";@ss=@ss+"/";end if (!FileTest.directory?(@ss)) exit() end # ebtpath="/mnt/cf/ebt/" # mkpath="/mnt/cf/ebt_html/" ebtpath=@ss tmp=ebtpath[0..-2] mkpath=tmp[0..tmp.rindex("/")]+"ebt_html/" @@mkpath="#{mkpath}"; if (!FileTest.directory?(mkpath)) Dir.mkdir(mkpath); end dirs = Array.new();files = Array.new() Dir.foreach(ebtpath) { |file| if (FileTest.directory?(File.join(ebtpath, file))); dirs.push(file) else; files.push(file); end } @fp = File.new(mkpath+"index.html", "w"); @fp.puts"\n