Ruby初心者スレッド Part 12
■ このスレッドは過去ログ倉庫に格納されています
0451449
2007/05/26(土) 05:31:30すいません、詳しく書きますと、vrubyにてドロップされたフォルダを、そのフォルダ構成ごとzip圧縮したいということです。
以下、その部分のロジックのコードです。
def self_dropfiles(files)
d_file = files.to_s #ドロップされたフォルダパス
Dir.chdir(d_file) #ドロップされたフォルダをカレントディレクトリにする
inner_files = Dir.glob("**/*.*") #カレントディレクトリ内の拡張子が付くファイルを配列にする
Zip::ZipFile.open(zip_name, Zip::ZipFile::CREATE) {|zf|
inner_files.each do |i|
zf.add(NKF::nkf("-s",i), i)
end
}
end
RDEにて下記のエラーが出る。
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
※但し、階層が1つだけで「html」や「txt」などのtxt系ファイルだけの場合は圧縮が成功します。
hoge →これはOK
├hoge.txt
└hoge.html
hoge →これは×
├hoge.txt
└hoge.swf
hoge →これは×
├hoge.txt
├hoge.html
└sub_dir(フォルダ)
└hoge.txt
■ このスレッドは過去ログ倉庫に格納されています