Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
paths_darwin.mm
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/fml/paths.h"
6
7#include <Foundation/Foundation.h>
8
9#include "flutter/fml/file.h"
10
11namespace fml {
12namespace paths {
13
14std::pair<bool, std::string> GetExecutablePath() {
15 @autoreleasepool {
16 return {true, [NSBundle mainBundle].executablePath.UTF8String};
17 }
18}
19
21 @autoreleasepool {
22 auto items = [[NSFileManager defaultManager] URLsForDirectory:NSCachesDirectory
23 inDomains:NSUserDomainMask];
24 if (items.count == 0) {
25 return {};
26 }
27
28 return OpenDirectory(items[0].fileSystemRepresentation, false, FilePermission::kRead);
29 }
30}
31
32} // namespace paths
33} // namespace fml
std::pair< bool, std::string > GetExecutablePath()
fml::UniqueFD GetCachesDirectory()
fml::UniqueFD OpenDirectory(const char *path, bool create_if_necessary, FilePermission permission)
Definition file_posix.cc:97