diff options
author | Henrik Nord <[email protected]> | 2012-12-10 15:17:43 +0100 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2012-12-10 15:17:47 +0100 |
commit | 3d68194518f154c9c7e440b096c311cd2572dd78 (patch) | |
tree | 367d8387b1dda02fc7db391772a4b4484e8f646d | |
parent | fc653d7a69b0d689c76e6f04f9f185701756c125 (diff) | |
parent | b71a932b3722af16066c9c5da88bee2897e6da4a (diff) | |
download | otp-3d68194518f154c9c7e440b096c311cd2572dd78.tar.gz otp-3d68194518f154c9c7e440b096c311cd2572dd78.tar.bz2 otp-3d68194518f154c9c7e440b096c311cd2572dd78.zip |
Merge branch 'hm/debugger_settings_dialog'
* hm/debugger_settings_dialog:
Fix Debugger settings dialog due to changed behavior in wxFileDialog
OTP-10621
-rw-r--r-- | lib/debugger/src/dbg_wx_settings.erl | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/lib/debugger/src/dbg_wx_settings.erl b/lib/debugger/src/dbg_wx_settings.erl index 3be93c495c..94ecc5781d 100644 --- a/lib/debugger/src/dbg_wx_settings.erl +++ b/lib/debugger/src/dbg_wx_settings.erl @@ -49,31 +49,35 @@ save(Win, Pos, SFile) -> open_win(Win, Pos, SFile, Str, What) -> {SDir, SFileName} = - if - %% If settings are saved for the first time, and to - %% the default directory HOME/erlang.tools/debugger, - %% make sure the directory exists, or create it if - %% desired and possible - SFile==default -> {default_settings_dir(Win), "NoName.state"}; - true -> {filename:dirname(SFile), filename:basename(SFile)} - end, - + if + %% If settings are saved for the first time, and to + %% the default directory HOME/erlang.tools/debugger, + %% make sure the directory exists, or create it if + %% desired and possible + SFile==default -> {default_settings_dir(Win), "NoName.state"}; + true -> {filename:dirname(SFile), filename:basename(SFile)} + end, + FD = wxFileDialog:new(Win, [{message,Str},{pos, Pos}, - {defaultDir,SDir}, - {defaultFile,SFileName}, - {wildCard, "*.state"}, - {style,What}]), + {defaultDir,SDir}, + {defaultFile,SFileName}, + {wildCard, "*.state"}, + {style,What}]), case wxFileDialog:showModal(FD) of - ?wxID_OK -> - File = wxFileDialog:getFilename(FD), - Dir = wxFileDialog:getDirectory(FD), - wxFileDialog:destroy(FD), - {ok, filename:join(Dir,File)}; - _ -> - wxFileDialog:destroy(FD), - cancel + ?wxID_OK -> + case wxFileDialog:getPaths(FD) of + [NewFile] -> + wxFileDialog:destroy(FD), + {ok, NewFile}; + _ -> + wxFileDialog:destroy(FD), + cancel + end; + _ -> + wxFileDialog:destroy(FD), + cancel end. - + default_settings_dir(Win) -> {ok, [[Home]]} = init:get_argument(home), DefDir = filename:join([Home, ".erlang_tools", "debugger"]), |