mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
34 lines
892 B
Plaintext
34 lines
892 B
Plaintext
// Copyright 2013 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "flutter/fml/paths.h"
|
|
|
|
#include <Foundation/Foundation.h>
|
|
|
|
#include "flutter/fml/file.h"
|
|
|
|
namespace fml {
|
|
namespace paths {
|
|
|
|
std::pair<bool, std::string> GetExecutableDirectoryPath() {
|
|
@autoreleasepool {
|
|
return {true, GetDirectoryName([NSBundle mainBundle].executablePath.UTF8String)};
|
|
}
|
|
}
|
|
|
|
fml::UniqueFD GetCachesDirectory() {
|
|
@autoreleasepool {
|
|
auto items = [[NSFileManager defaultManager] URLsForDirectory:NSCachesDirectory
|
|
inDomains:NSUserDomainMask];
|
|
if (items.count == 0) {
|
|
return {};
|
|
}
|
|
|
|
return OpenDirectory(items[0].fileSystemRepresentation, false, FilePermission::kRead);
|
|
}
|
|
}
|
|
|
|
} // namespace paths
|
|
} // namespace fml
|