Skip to content

Commit

Permalink
fixing windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
wkjarosz committed Dec 10, 2023
1 parent 13d96c8 commit 7bf5913
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,26 +603,20 @@ void SampleViewer::draw_editor()
if (ImGui::Button(ICON_FA_FOLDER_OPEN))
{
#ifdef __EMSCRIPTEN__
static int csv_index = m_sampler;
static CSVFile *s_csv_file = csv;
auto handle_upload_file =
[](const string &filename, const string &mime_type, string_view buffer, void *my_data = nullptr)
{
// define a handler to process the file
// ...

auto that{reinterpret_cast<SampleViewer *>(my_data)};
HelloImGui::Log(HelloImGui::LogLevel::Debug,
"Received upload callback for file '%s', mime_type '%s' %d", filename.c_str(),
mime_type.c_str(), csv_index);
HelloImGui::Log(HelloImGui::LogLevel::Debug, "Loading file '%s' of mime type '%s' ...",
filename.c_str(), mime_type.c_str());
s_csv_file->read(filename, buffer);
that->m_gpu_points_dirty = that->m_cpu_points_dirty = that->m_gpu_grids_dirty = true;
};

HelloImGui::Log(HelloImGui::LogLevel::Debug, "About to open file dialog");
// open the browser's file selector, and pass the file to the upload handler
emscripten_browser_file::upload(".csv,.txt", handle_upload_file, this);
HelloImGui::Log(HelloImGui::LogLevel::Debug, "After open file dialog");
HelloImGui::Log(HelloImGui::LogLevel::Debug, "Requesting file from user");
#else
auto result = pfd::open_file("Open CSV file", "", {"CSV files", "*.csv *.txt"}).result();
if (!result.empty())
Expand Down
2 changes: 1 addition & 1 deletion src/sampler/CSVFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ string read_file_to_string(string_view path)
auto stream = std::ifstream(path.data());
stream.exceptions(std::ios_base::badbit);

if (not stream)
if (!stream)
throw std::ios_base::failure("file does not exist");

auto out = std::string();
Expand Down

0 comments on commit 7bf5913

Please sign in to comment.