diff --git a/lib/MPW.rb b/lib/MPW.rb index 8d6f7ce..8d36894 100644 --- a/lib/MPW.rb +++ b/lib/MPW.rb @@ -107,8 +107,8 @@ class MPW file_pwd << passwd file_pwd.close end - rescue - @error_msg = "Can't decrypt file!" + rescue Exception => e + @error_msg = "Can't decrypt file!\n#{e}" return false end @@ -119,7 +119,7 @@ class MPW id = 0 data_decrypt.lines do |line| - @data[id] = line.parse_csv.unshift(id) + @data[id] = line.parse_csv({:col_sep => ';'}).unshift(id) id += 1; end end @@ -158,7 +158,7 @@ class MPW data_to_encrypt = '' @data.each do |row| row.shift - data_to_encrypt << "#{row.join(',')}\n" + data_to_encrypt << "#{row.join(';')}\n" end crypto.encrypt(data_to_encrypt, :recipients => @key, :output => file_gpg) @@ -317,11 +317,11 @@ class MPW begin data_new = IO.read(file) data_new.lines do |line| - if not line =~ /(.*,){6}/ + if not line =~ /(.*;){6}/ @error_msg = "Can't import, the file is bad format!" return false else - row = line.parse_csv.unshift(0) + row = line.parse_csv({:col_sep => ';'}).unshift(0) if not add(row[NAME], row[GROUP], row[SERVER], row[PROTOCOL], row[LOGIN], row[PASSWORD], row[PORT], row[COMMENT]) return false end @@ -345,11 +345,11 @@ class MPW data = IO.read(file) data.lines do |line| - if not line =~ /(.*,){6}/ + if not line =~ /(.*;){6}/ @error_msg = "Can't import, the file is bad format!" return false else - result.push(line.parse_csv.unshift(id)) + result.push(line.parse_csv({:col_sep => ';'}).unshift(id)) end id += 1