mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-04 21:14:43 +00:00
Allow building both Cocoa and dummy dialog implementations
This allows us to remove platformFilters from the Xcode project, which is not supported in Xcode 12.
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
#include "SDL_internal.h"
|
||||
#include "../SDL_dialog_utils.h"
|
||||
|
||||
#ifdef SDL_PLATFORM_MACOS
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <UniformTypeIdentifiers/UTType.h>
|
||||
|
||||
@@ -33,10 +35,6 @@ typedef enum
|
||||
|
||||
void show_file_dialog(cocoa_FileDialogType type, SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, int nfilters, const char* default_location, bool allow_many)
|
||||
{
|
||||
#if defined(SDL_PLATFORM_TVOS) || defined(SDL_PLATFORM_IOS)
|
||||
SDL_SetError("tvOS and iOS don't support path-based file dialogs");
|
||||
callback(userdata, NULL, -1);
|
||||
#else
|
||||
if (filters) {
|
||||
const char *msg = validate_filters(filters, nfilters);
|
||||
|
||||
@@ -175,7 +173,6 @@ void show_file_dialog(cocoa_FileDialogType type, SDL_DialogFileCallback callback
|
||||
callback(userdata, files, -1);
|
||||
}
|
||||
}
|
||||
#endif // defined(SDL_PLATFORM_TVOS) || defined(SDL_PLATFORM_IOS)
|
||||
}
|
||||
|
||||
void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, int nfilters, const char* default_location, bool allow_many)
|
||||
@@ -192,3 +189,5 @@ void SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void* userdata, S
|
||||
{
|
||||
show_file_dialog(FDT_OPENFOLDER, callback, userdata, window, NULL, 0, default_location, allow_many);
|
||||
}
|
||||
|
||||
#endif // SDL_PLATFORM_MACOS
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
*/
|
||||
#include "SDL_internal.h"
|
||||
|
||||
#ifdef SDL_DIALOG_DUMMY
|
||||
|
||||
void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, int nfilters, const char* default_location, bool allow_many)
|
||||
{
|
||||
SDL_Unsupported();
|
||||
@@ -37,3 +39,5 @@ void SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void* userdata, S
|
||||
SDL_Unsupported();
|
||||
callback(userdata, NULL, -1);
|
||||
}
|
||||
|
||||
#endif // SDL_DIALOG_DUMMY
|
||||
|
||||
Reference in New Issue
Block a user