Skip to content

Commit

Permalink
SAM #1830 - writing out JSON on multiple platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
sjanzou committed Aug 15, 2024
1 parent ad424b3 commit e3c70d7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/invoke.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <wx/arrstr.h>
#include <wx/progdlg.h>

// SAM 1830
#include <wx/file.h>

#include <wex/plot/plplotctrl.h>
#include <wex/lkscript.h>
#include <wex/dview/dvplotctrl.h>
Expand Down Expand Up @@ -6073,6 +6076,16 @@ static void fcall_reopt_size_battery(lk::invoke_t& cxt)
curl.AddHttpHeader("Content-Type: application/json");
curl.SetPostData(reopt_jsonpost);

// write to file for SAM issue 1830
wxString filename = SamApp::GetAppPath() + "reopt_jsonpost.json";
wxFile file(filename, wxFile::write);
if (!file.IsOpened()) {
wxLogError("Could not open file for writing!");
return;
}
file.Write(reopt_jsonpost);
file.Close();

wxString msg, err;
if (!curl.Get(post_url, msg))
{
Expand Down

0 comments on commit e3c70d7

Please sign in to comment.