Commit b1fb9e80 authored by Hidehiko Abe's avatar Hidehiko Abe Committed by Commit Bot

ChromeOS: Creates XDG_RUNTIME_DIR if missing.

On chromeos-chrome on Linux for development purpose,
if XDG_RUNTIME_DIR is set, but it is missing,
create it.

Bug: 1107789
Test: Ran locally.
Change-Id: I42086e71fed05976f40508c86f2c5644dd565a17
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2310030
Commit-Queue: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790454}
parent 561b40b5
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include "ui/display/screen.h" #include "ui/display/screen.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "base/system/sys_info.h"
#include "components/exo/wayland/wl_shell.h" #include "components/exo/wayland/wl_shell.h"
#include "components/exo/wayland/xdg_shell.h" #include "components/exo/wayland/xdg_shell.h"
#include "components/exo/wayland/zcr_color_space.h" #include "components/exo/wayland/zcr_color_space.h"
...@@ -237,12 +238,23 @@ Server::~Server() { ...@@ -237,12 +238,23 @@ Server::~Server() {
std::unique_ptr<Server> Server::Create(Display* display) { std::unique_ptr<Server> Server::Create(Display* display) {
std::unique_ptr<Server> server(new Server(display)); std::unique_ptr<Server> server(new Server(display));
char* runtime_dir = getenv("XDG_RUNTIME_DIR"); char* runtime_dir_str = getenv("XDG_RUNTIME_DIR");
if (!runtime_dir) { if (!runtime_dir_str) {
LOG(ERROR) << "XDG_RUNTIME_DIR not set in the environment"; LOG(ERROR) << "XDG_RUNTIME_DIR not set in the environment";
return nullptr; return nullptr;
} }
const base::FilePath runtime_dir(runtime_dir_str);
#if defined(OS_CHROMEOS)
// On debugging chromeos-chrome on linux platform,
// try to ensure the directory if missing.
if (!base::SysInfo::IsRunningOnChromeOS()) {
CHECK(base::DirectoryExists(runtime_dir) ||
base::CreateDirectory(runtime_dir))
<< "Failed to create XDG_RUNTIME_DIR";
}
#endif // defined(OS_CHROMEOS)
std::string socket_name(kSocketName); std::string socket_name(kSocketName);
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kWaylandServerSocket)) { if (command_line->HasSwitch(switches::kWaylandServerSocket)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment