• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <unistd.h>
8 
9 #include "flutter/fml/paths.h"
10 
11 namespace fml {
12 namespace paths {
13 
GetExecutableDirectoryPath()14 std::pair<bool, std::string> GetExecutableDirectoryPath() {
15   const int path_size = 255;
16   char path[path_size] = {0};
17   auto read_size = ::readlink("/proc/self/exe", path, path_size);
18   if (read_size == -1) {
19     return {false, ""};
20   }
21   return {true, fml::paths::GetDirectoryName(
22                     std::string{path, static_cast<size_t>(read_size)})};
23 }
24 
GetCachesDirectory()25 fml::UniqueFD GetCachesDirectory() {
26   // Unsupported on this platform.
27   return {};
28 }
29 
30 }  // namespace paths
31 }  // namespace fml
32