Reduce platform legacy adapter tail
This commit is contained in:
@@ -6,6 +6,11 @@
|
||||
#include <array>
|
||||
#include <utility>
|
||||
|
||||
#if defined(__IOS__) || defined(__OSX__)
|
||||
#include "app_core/app.h"
|
||||
#include <dispatch/dispatch.h>
|
||||
#endif
|
||||
|
||||
namespace pp::platform::apple {
|
||||
namespace {
|
||||
|
||||
@@ -125,4 +130,34 @@ std::string AppleDocumentPlatformServices::format_working_directory_path(std::st
|
||||
return std::string(path);
|
||||
}
|
||||
|
||||
void AppleDocumentPlatformServices::display_file(std::string_view path) const
|
||||
{
|
||||
const std::string value(path);
|
||||
#if defined(__IOS__)
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[App::I->ios_view display_file:value];
|
||||
});
|
||||
#elif defined(__OSX__)
|
||||
[[NSWorkspace sharedWorkspace] openFile:[NSString stringWithUTF8String:value.c_str()]];
|
||||
#else
|
||||
(void)value;
|
||||
#endif
|
||||
}
|
||||
|
||||
void AppleDocumentPlatformServices::share_file(std::string_view path) const
|
||||
{
|
||||
const std::string value(path);
|
||||
#if defined(__IOS__)
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[App::I->ios_view share_file:[NSString stringWithUTF8String:value.c_str()]];
|
||||
});
|
||||
#elif defined(__OSX__)
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[App::I->osx_view share_file:[NSString stringWithUTF8String:value.c_str()]];
|
||||
});
|
||||
#else
|
||||
(void)value;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user