Add executable permission in CopyFileOut
This commit is contained in:
parent
6ef6a83042
commit
cfdcfcbd80
4 changed files with 9 additions and 15 deletions
|
@ -54,7 +54,6 @@ class Archive : public mate::Wrappable {
|
||||||
mate::Dictionary dict(isolate, v8::Object::New(isolate));
|
mate::Dictionary dict(isolate, v8::Object::New(isolate));
|
||||||
dict.Set("size", stats.size);
|
dict.Set("size", stats.size);
|
||||||
dict.Set("offset", stats.offset);
|
dict.Set("offset", stats.offset);
|
||||||
dict.Set("executable", stats.executable);
|
|
||||||
dict.Set("isFile", stats.is_file);
|
dict.Set("isFile", stats.is_file);
|
||||||
dict.Set("isDirectory", stats.is_directory);
|
dict.Set("isDirectory", stats.is_directory);
|
||||||
dict.Set("isLink", stats.is_link);
|
dict.Set("isLink", stats.is_link);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "atom/common/asar/scoped_temporary_file.h"
|
#include "atom/common/asar/scoped_temporary_file.h"
|
||||||
#include "base/files/file.h"
|
#include "base/files/file.h"
|
||||||
|
#include "base/files/file_util.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/pickle.h"
|
#include "base/pickle.h"
|
||||||
#include "base/json/json_reader.h"
|
#include "base/json/json_reader.h"
|
||||||
|
@ -96,7 +97,6 @@ bool FillFileInfoWithNode(Archive::FileInfo* info,
|
||||||
return false;
|
return false;
|
||||||
info->size = static_cast<uint32>(size);
|
info->size = static_cast<uint32>(size);
|
||||||
|
|
||||||
info->unpacked = false;
|
|
||||||
if (node->GetBoolean("unpacked", &info->unpacked) && info->unpacked)
|
if (node->GetBoolean("unpacked", &info->unpacked) && info->unpacked)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -107,7 +107,6 @@ bool FillFileInfoWithNode(Archive::FileInfo* info,
|
||||||
return false;
|
return false;
|
||||||
info->offset += header_size;
|
info->offset += header_size;
|
||||||
|
|
||||||
info->executable = false;
|
|
||||||
node->GetBoolean("executable", &info->executable);
|
node->GetBoolean("executable", &info->executable);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -276,6 +275,13 @@ bool Archive::CopyFileOut(const base::FilePath& path, base::FilePath* out) {
|
||||||
if (!temp_file->InitFromFile(&file_, info.offset, info.size))
|
if (!temp_file->InitFromFile(&file_, info.offset, info.size))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#if defined(OS_POSIX)
|
||||||
|
if (info.executable) {
|
||||||
|
// chmod a+x temp_file;
|
||||||
|
base::SetPosixFilePermissions(temp_file->path(), 0755);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
*out = temp_file->path();
|
*out = temp_file->path();
|
||||||
external_files_.set(path, temp_file.Pass());
|
external_files_.set(path, temp_file.Pass());
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -25,7 +25,7 @@ class ScopedTemporaryFile;
|
||||||
class Archive {
|
class Archive {
|
||||||
public:
|
public:
|
||||||
struct FileInfo {
|
struct FileInfo {
|
||||||
FileInfo() : size(0), offset(0) {}
|
FileInfo() : unpacked(false), executable(false), size(0), offset(0) {}
|
||||||
bool unpacked;
|
bool unpacked;
|
||||||
bool executable;
|
bool executable;
|
||||||
uint32 size;
|
uint32 size;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
asar = process.binding 'atom_common_asar'
|
asar = process.binding 'atom_common_asar'
|
||||||
child_process = require 'child_process'
|
child_process = require 'child_process'
|
||||||
fs = require 'fs'
|
|
||||||
path = require 'path'
|
path = require 'path'
|
||||||
util = require 'util'
|
util = require 'util'
|
||||||
|
|
||||||
|
@ -84,11 +83,6 @@ overrideAPISync = (module, name, arg = 0) ->
|
||||||
newPath = archive.copyFileOut filePath
|
newPath = archive.copyFileOut filePath
|
||||||
notFoundError asarPath, filePath unless newPath
|
notFoundError asarPath, filePath unless newPath
|
||||||
|
|
||||||
stat = archive.stat filePath
|
|
||||||
|
|
||||||
if stat.executable
|
|
||||||
fs.chmodSync(newPath, 0o755)
|
|
||||||
|
|
||||||
arguments[arg] = newPath
|
arguments[arg] = newPath
|
||||||
old.apply this, arguments
|
old.apply this, arguments
|
||||||
|
|
||||||
|
@ -108,11 +102,6 @@ overrideAPI = (module, name, arg = 0) ->
|
||||||
newPath = archive.copyFileOut filePath
|
newPath = archive.copyFileOut filePath
|
||||||
return notFoundError asarPath, filePath, callback unless newPath
|
return notFoundError asarPath, filePath, callback unless newPath
|
||||||
|
|
||||||
stat = archive.stat filePath
|
|
||||||
|
|
||||||
if stat.executable
|
|
||||||
fs.chmodSync(newPath, 0o755)
|
|
||||||
|
|
||||||
arguments[arg] = newPath
|
arguments[arg] = newPath
|
||||||
old.apply this, arguments
|
old.apply this, arguments
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue