Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions impeller/compiler/impellerc_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include <filesystem>
#include <system_error>

#include "flutter/fml/backtrace.h"
#include "flutter/fml/command_line.h"
Expand All @@ -20,6 +21,21 @@
namespace impeller {
namespace compiler {

// Sets the file access mode of the file at path 'p' to 0644.
static bool SetPermissiveAccess(const std::filesystem::path& p) {
auto permissions =
std::filesystem::perms::owner_read | std::filesystem::perms::owner_write |
std::filesystem::perms::group_read | std::filesystem::perms::others_read;
std::error_code error;
std::filesystem::permissions(p, permissions, error);
if (error) {
std::cerr << "Failed to set access on file '" << p
<< "': " << error.message() << std::endl;
return false;
}
return true;
}

bool Main(const fml::CommandLine& command_line) {
fml::InstallCrashHandler();
if (command_line.HasOption("help")) {
Expand Down Expand Up @@ -110,6 +126,11 @@ bool Main(const fml::CommandLine& command_line) {
<< std::endl;
return false;
}
// Tools that consume the runtime stage data expect the access mode to
// be 0644.
if (!SetPermissiveAccess(sl_file_name)) {
return false;
}
} else {
if (!fml::WriteAtomically(*switches.working_directory,
sl_file_name.string().c_str(),
Expand Down