From ece483048c8c2c62673b6fce626ed9623048eaec Mon Sep 17 00:00:00 2001 From: Jean-Denis Boivin Date: Sat, 11 Feb 2017 15:57:35 -0500 Subject: [PATCH 1/2] Fix for #919 - Add Filter to FileDialog save (Windows only) --- project/src/ui/FileDialog.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/project/src/ui/FileDialog.cpp b/project/src/ui/FileDialog.cpp index d3b745ad0..0410e0eaf 100644 --- a/project/src/ui/FileDialog.cpp +++ b/project/src/ui/FileDialog.cpp @@ -163,11 +163,12 @@ namespace lime { std::wstring* FileDialog::SaveFile (std::wstring* filter, std::wstring* defaultPath) { - // TODO: Filters - #ifdef HX_WINDOWS - const wchar_t* path = tinyfd_saveFileDialogW (L"", defaultPath ? defaultPath->c_str () : 0, 0, NULL, NULL); + std::wstring temp(L"*."); + const wchar_t* filters[] = {filter ? (temp + *filter).c_str() : NULL}; + + const wchar_t* path = tinyfd_saveFileDialogW (L"", defaultPath ? defaultPath->c_str () : 0, filter ? 1 : 0, filter ? filters : NULL, NULL); if (path) { @@ -178,6 +179,8 @@ namespace lime { #else + // TODO: Filters + char* _defaultPath = 0; if (defaultPath) { @@ -207,4 +210,4 @@ namespace lime { } -} \ No newline at end of file +} From e6cf43bbdf62da52be9d35d0e9079983fdb440f7 Mon Sep 17 00:00:00 2001 From: Jean-Denis Boivin Date: Sat, 11 Feb 2017 16:10:02 -0500 Subject: [PATCH 2/2] Code Clean --- project/src/ui/FileDialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/src/ui/FileDialog.cpp b/project/src/ui/FileDialog.cpp index 0410e0eaf..e0b2eac26 100644 --- a/project/src/ui/FileDialog.cpp +++ b/project/src/ui/FileDialog.cpp @@ -165,8 +165,8 @@ namespace lime { #ifdef HX_WINDOWS - std::wstring temp(L"*."); - const wchar_t* filters[] = {filter ? (temp + *filter).c_str() : NULL}; + std::wstring temp (L"*."); + const wchar_t* filters[] = {filter ? (temp + *filter).c_str () : NULL}; const wchar_t* path = tinyfd_saveFileDialogW (L"", defaultPath ? defaultPath->c_str () : 0, filter ? 1 : 0, filter ? filters : NULL, NULL);