implement pick_dir on windows, upload VS project,
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
void displayKeyboard(android_app* mApplication, bool pShow);
|
||||
void pick_file(android_app* mApplication, std::function<void(std::string)> callback);
|
||||
#elif _WIN32
|
||||
std::string win32_open_file();
|
||||
std::string win32_open_file(const char* filter);
|
||||
std::string win32_open_dir();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -59,7 +60,7 @@ void App::pick_image(std::function<void(std::string path)> callback)
|
||||
#elif __ANDROID__
|
||||
pick_file(and_app, callback);
|
||||
#elif _WIN32
|
||||
std::string path = win32_open_file();
|
||||
std::string path = win32_open_file("Image Files (*.jpg, *.png)\0*.jpg;*.png");
|
||||
if (!path.empty())
|
||||
callback(path);
|
||||
#endif
|
||||
@@ -84,7 +85,21 @@ void App::pick_file(std::vector<std::string> types, std::function<void (std::str
|
||||
#elif __ANDROID__
|
||||
pick_file(and_app, callback);
|
||||
#elif _WIN32
|
||||
std::string path = win32_open_file();
|
||||
std::string filter = "Image Files (";
|
||||
bool first_type = true;
|
||||
for (auto& t : types)
|
||||
{
|
||||
filter += std::string(first_type ? "" : " ,") + "*." + t;
|
||||
first_type = false;
|
||||
}
|
||||
filter += ")\0";
|
||||
first_type = true;
|
||||
for (auto& t : types)
|
||||
{
|
||||
filter += std::string(first_type ? "" : ";") + "*." + t;
|
||||
first_type = false;
|
||||
}
|
||||
std::string path = win32_open_file(filter.c_str());
|
||||
if (!path.empty())
|
||||
callback(path);
|
||||
#endif
|
||||
@@ -105,9 +120,9 @@ void App::pick_dir(std::function<void(std::string path)> callback)
|
||||
// NOT IMPLEMENTED
|
||||
#elif _WIN32
|
||||
// TODO: to be implemented
|
||||
// std::string path = win32_open_file();
|
||||
// if (!path.empty())
|
||||
// callback(path);
|
||||
std::string path = win32_open_dir();
|
||||
if (!path.empty())
|
||||
callback(path);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user