|
7 | 7 | #import "flutter/shell/platform/darwin/macos/framework/Source/FlutterEngine_Internal.h" |
8 | 8 |
|
9 | 9 | #include <algorithm> |
10 | | -#include <filesystem> |
11 | 10 | #include <vector> |
12 | 11 |
|
13 | 12 | #import "flutter/shell/platform/darwin/macos/framework/Source/FlutterDartProject_Internal.h" |
@@ -324,24 +323,25 @@ - (UniqueAotDataPtr)loadAOTData:(NSString*)assetsDir { |
324 | 323 | return nullptr; |
325 | 324 | } |
326 | 325 |
|
| 326 | + BOOL isDirOut = false; // required for NSFileManager fileExistsAtPath. |
| 327 | + NSFileManager* fileManager = [NSFileManager defaultManager]; |
| 328 | + |
327 | 329 | // This is the location where the test fixture places the snapshot file. |
328 | 330 | // For applications built by Flutter tool, this is in "App.framework". |
329 | | - std::filesystem::path assetsFsDir(assetsDir.UTF8String); |
330 | | - std::filesystem::path elfFile("app_elf_snapshot.so"); |
331 | | - auto fullElfPath = assetsFsDir / elfFile; |
| 331 | + NSString* elfPath = [NSString pathWithComponents:@[ assetsDir, @"app_elf_snapshot.so" ]]; |
332 | 332 |
|
333 | | - if (!std::filesystem::exists(fullElfPath)) { |
| 333 | + if (![fileManager fileExistsAtPath:elfPath isDirectory:&isDirOut]) { |
334 | 334 | return nullptr; |
335 | 335 | } |
336 | 336 |
|
337 | 337 | FlutterEngineAOTDataSource source = {}; |
338 | 338 | source.type = kFlutterEngineAOTDataSourceTypeElfPath; |
339 | | - source.elf_path = fullElfPath.c_str(); |
| 339 | + source.elf_path = [elfPath cStringUsingEncoding:NSUTF8StringEncoding]; |
340 | 340 |
|
341 | 341 | FlutterEngineAOTData data = nullptr; |
342 | 342 | auto result = FlutterEngineCreateAOTData(&source, &data); |
343 | 343 | if (result != kSuccess) { |
344 | | - NSLog(@"Failed to load AOT data from: %@", @(fullElfPath.c_str())); |
| 344 | + NSLog(@"Failed to load AOT data from: %@", elfPath); |
345 | 345 | return nullptr; |
346 | 346 | } |
347 | 347 |
|
|
0 commit comments