1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2024-11-23 13:57:52 +00:00

change , by ; in the csv file

This commit is contained in:
nishiki 2013-09-04 23:14:33 +02:00
parent 9ddd6f0a73
commit 94bd846bc7

View file

@ -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