Flutter Engine
The Flutter Engine
Functions
SkGetExecutablePath_linux.cpp File Reference
#include "tools/SkGetExecutablePath.h"
#include <cstddef>
#include <linux/limits.h>
#include <sys/types.h>
#include <unistd.h>

Go to the source code of this file.

Functions

std::string SkGetExecutablePath ()
 

Function Documentation

◆ SkGetExecutablePath()

std::string SkGetExecutablePath ( )

Returns a fully-qualified path to the currently-running executable.

Definition at line 16 of file SkGetExecutablePath_linux.cpp.

16 {
17 std::string result(PATH_MAX, '\0');
18 ssize_t len = readlink("/proc/self/exe", result.data(), result.size() - 1);
19 if (len < 0 || static_cast<size_t>(len) >= PATH_MAX - 1) {
20 result.clear();
21 } else {
22 result.resize(len);
23 }
24 return result;
25}
GAsyncResult * result
#define PATH_MAX
Definition: globals.h:708