2018-11-07 12:24:35 -08:00
|
|
|
// Copyright 2013 The Flutter Authors. All rights reserved.
|
2017-03-23 15:20:52 -07:00
|
|
|
// 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 <unistd.h>
|
|
|
|
|
|
2018-07-26 12:49:34 -07:00
|
|
|
#include "flutter/fml/paths.h"
|
2017-03-23 15:20:52 -07:00
|
|
|
|
|
|
|
|
namespace fml {
|
|
|
|
|
namespace paths {
|
|
|
|
|
|
|
|
|
|
std::pair<bool, std::string> GetExecutableDirectoryPath() {
|
|
|
|
|
const int path_size = 255;
|
|
|
|
|
char path[path_size] = {0};
|
|
|
|
|
auto read_size = ::readlink("/proc/self/exe", path, path_size);
|
|
|
|
|
if (read_size == -1) {
|
|
|
|
|
return {false, ""};
|
|
|
|
|
}
|
2018-07-26 13:40:29 -07:00
|
|
|
return {true, fml::paths::GetDirectoryName(
|
2017-09-12 15:36:20 -07:00
|
|
|
std::string{path, static_cast<size_t>(read_size)})};
|
2017-03-23 15:20:52 -07:00
|
|
|
}
|
|
|
|
|
|
2018-09-26 14:54:09 -07:00
|
|
|
fml::UniqueFD GetCachesDirectory() {
|
|
|
|
|
// Unsupported on this platform.
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-23 15:20:52 -07:00
|
|
|
} // namespace paths
|
|
|
|
|
} // namespace fml
|