Flutter Engine
The Flutter Engine
third_party
skia
tools
SkGetExecutablePath_linux.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2022 Google Inc.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#include "
tools/SkGetExecutablePath.h
"
9
#include <cstddef>
10
#include <linux/limits.h>
11
#include <sys/types.h>
12
#include <unistd.h>
13
14
// Note that /proc/self/exe is Linux-specific; this won't work on other UNIX systems.
15
16
std::string
SkGetExecutablePath
() {
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
}
SkGetExecutablePath.h
SkGetExecutablePath
std::string SkGetExecutablePath()
Definition:
SkGetExecutablePath_linux.cpp:16
result
GAsyncResult * result
Definition:
fl_text_input_plugin.cc:106
gn.find_headers.len
len
Definition:
find_headers.py:30
PATH_MAX
#define PATH_MAX
Definition:
globals.h:708
Generated on Sun Jun 23 2024 21:56:50 for Flutter Engine by
1.9.4