Do not overwrite odbc config file (#2295)
This commit is contained in:
parent
bbffd396f6
commit
ae7b391657
|
@ -1071,9 +1071,9 @@ init_mssql(Host) ->
|
||||||
case filelib:ensure_dir(freetds_config()) of
|
case filelib:ensure_dir(freetds_config()) of
|
||||||
ok ->
|
ok ->
|
||||||
try
|
try
|
||||||
ok = file:write_file(freetds_config(), FreeTDS, [append]),
|
ok = write_file_if_new(freetds_config(), FreeTDS),
|
||||||
ok = file:write_file(odbcinst_config(), ODBCINST),
|
ok = write_file_if_new(odbcinst_config(), ODBCINST),
|
||||||
ok = file:write_file(odbc_config(), ODBCINI, [append]),
|
ok = write_file_if_new(odbc_config(), ODBCINI),
|
||||||
os:putenv("ODBCSYSINI", tmp_dir()),
|
os:putenv("ODBCSYSINI", tmp_dir()),
|
||||||
os:putenv("FREETDS", freetds_config()),
|
os:putenv("FREETDS", freetds_config()),
|
||||||
os:putenv("FREETDSCONF", freetds_config()),
|
os:putenv("FREETDSCONF", freetds_config()),
|
||||||
|
@ -1089,6 +1089,12 @@ init_mssql(Host) ->
|
||||||
Err
|
Err
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
write_file_if_new(File, Payload) ->
|
||||||
|
case filelib:is_file(File) of
|
||||||
|
true -> ok;
|
||||||
|
false -> file:write_file(File, Payload)
|
||||||
|
end.
|
||||||
|
|
||||||
tmp_dir() ->
|
tmp_dir() ->
|
||||||
case os:type() of
|
case os:type() of
|
||||||
{win32, _} -> filename:join([os:getenv("HOME"), "conf"]);
|
{win32, _} -> filename:join([os:getenv("HOME"), "conf"]);
|
||||||
|
|
Loading…
Reference in New Issue