Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for wide-chars as casual calls to i.e. GetDirectory functions are LPWSTR #6

Closed
MaKiPL opened this issue Jan 28, 2020 · 5 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@MaKiPL
Copy link

MaKiPL commented Jan 28, 2020

Describe the bug
Currently the code tends to support only ANSI strings- however calls to functions like GetFullPathName or GetLogicalDriveStrings are extended to GetLogicalDriveStringsW, not GetLogicalDriveStringsA- therefore ImGuiFileDialog will crash as it won't expect one-byte char but two-bytes char if strings will be cased to LPCWSTR or LPWSTR

To Reproduce
-/-

Expected behavior
Change all std::string to std::wstring and char to WCHAR

Desktop (please complete the following information):

  • OS: Windows 10
  • Visual Studio 2019 with C++17
@MaKiPL MaKiPL changed the title Support for wide-chars as casual calls to in example GetDirectory functions are LPCWSTR Support for wide-chars as casual calls to i.e. GetDirectory functions are LPCWSTR Jan 28, 2020
@MaKiPL MaKiPL changed the title Support for wide-chars as casual calls to i.e. GetDirectory functions are LPCWSTR Support for wide-chars as casual calls to i.e. GetDirectory functions are LPWSTR Jan 28, 2020
@aiekick
Copy link
Owner

aiekick commented Jan 28, 2020

ok, im not very familiar with wide chars.
its for unicode support ?

can you propose a PR ?

@aiekick aiekick added bug Something isn't working enhancement New feature or request labels Jan 28, 2020
@aiekick
Copy link
Owner

aiekick commented Feb 8, 2020

if i change all std::string to std::wstring and char to WCHAR i break ImGui, who is not supproting wide char for the moment.
it will be difficult to support both modes. but i can use only GetLogicalDriveStringsA, CreateDirectoryA, and other func directly for avoid unicode crash

aiekick added a commit that referenced this issue Feb 8, 2020
switch : 
* GetFullPathName to GetFullPathNameA
* CreateDirectory to CreateDirectoryA
* GetLogicalDriveStrings to GetLogicalDriveStringsA
by ex with GetLogicalDriveStrings 
    for avoid use of GetLogicalDriveStringsW with the call to GetLogicalDriveStrings if UNICODE is enabled
@sonoro1234
Copy link

Wide char version of windows functions should be used, then wide chars are converted to utf-8 so that imgui could use them. When you go from imgui to wide chat filesystem functions you need the opposite conversion.
Basically you need two functions: from WideChar2UTF and UTF2WideChar,
This are the ones I made for LuaJIT: https://github.com/sonoro1234/luafilesystem/blob/unicode/lfs_ffi.lua#L190

@aiekick
Copy link
Owner

aiekick commented Apr 22, 2020

if i do in code
#define std::string std::wtring
#define char wchar_t
with corret include file as well
when we want wchar ? its ok ?

because i found many issue with wchar in the imgui doc about perf. not sure about the problem and the solution you propose, since i have no more information

the best way is, you propose a PR i think

@aiekick
Copy link
Owner

aiekick commented Sep 22, 2021

hello there,

i have finally created an implementation with std::filesystem (c++17) of the new ImGuiFileDialog

you just need to use this define in the config file

#define USE_STD_FILESYSTEM

you can test that in the branch : https://github.com/aiekick/ImGuiFileDialog/tree/Lib_Only_Std__FileSystem_WIP

as i know the unicode is fully supported now, ( just fixed a bug in the path composer)

@aiekick aiekick reopened this Sep 22, 2021
@aiekick aiekick closed this as completed Oct 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants