ocornut / imgui_test_engine

Dear ImGui Automation Engine & Test Suite
386 stars 40 forks source link

Provide Windows implementation for function ImFileExist #22

Closed aandrejevas closed 1 year ago

aandrejevas commented 1 year ago

image Hello, right now this function shown in the picture above does not compile on Windows. An implementation should be provided that would compile on Windows. This function (ImFileExist) is defined in file imgui_te_utils.cpp.

ocornut commented 1 year ago

Please be reasonable and explain what doesn’t compile for you and provide details and context and compiler info, because clearly it compiles for us seeing we are building the test engine everyday.

aandrejevas commented 1 year ago

Yes, sorry, I made many assumptions. I just saw the function stat being used and I instantly thought that this was an implementation not for Windows. Now I know that Microsoft has implemented many POSIX functions as extensions also.

The minimal demo app compiles and runs fine using Visual Studio.

I am trying to compile my app with gcc. These are the errors I get (the command in the picture is not the one I actually use): image

This is the info about the compiler I use: image

So now I think that something with the includes in the file imgui_te_utils.cpp might be wrong. I added the includes that I read in a microsoft website are required by the stat function. After that (and some other unrelated problem fixes) everything compiled and I was able to run my app. These are my changes: image

ocornut commented 1 year ago

Thanks a lot for investigating! Will push fix asap.

ocornut commented 1 year ago

I have pushed 054b8a3 with what I believe is the slightly more correct fix, which is to test for #ifdef _MSC_VER, it is a least consistent with the same tests we use in variety of imgui backends.

Thanks again!