Commit graph

44 commits

Author SHA1 Message Date
Milan Burda
2337237d58 Refactoring: use C++11 class member variable initialization 2018-05-22 00:18:38 +02:00
Shelley Vohr
c6f4bbd143
also format missing .cc files 2018-04-18 20:48:45 -04:00
Cheng Zhao
1072c75e38 Closing asar file should be syncronous 2018-01-03 19:12:16 +09:00
Cheng Zhao
fb78052b3d Remove unnecessary scope 2018-01-03 19:10:48 +09:00
deepak1556
1d95241185 FIXME: refactor and remove usage of ScopedAllowIO where possible 2018-01-02 16:37:06 +09:00
Ales Pergl
64d9e5b861 Removed obsolete io.h wrappers, included atlbase.h in atom_main.cc 2017-08-30 10:43:29 +02:00
Cheng Zhao
50e3bfa764 Fix API changes of base::Value 2017-04-27 16:34:52 +09:00
Cheng Zhao
fc2d62d5cb Fix API changes of Chrome58 2017-04-27 16:34:52 +09:00
Kevin Sawicki
6285500cdc Sort includes alphabetically 2016-08-26 15:30:02 -07:00
Haojian Wu
fab02809c6 Modernize to C++11: NULL => nullptr.
No functional change.
2016-07-10 11:57:04 +02:00
Cheng Zhao
7ba391da7c Update to API changes of Chrome 51 2016-05-23 10:59:39 +09:00
Cheng Zhao
e609a5bee2 Fix passing fd across modules 2016-05-19 16:38:37 +09:00
Cheng Zhao
5fae63a2f5 Fix compilation errors on OS X 2016-03-10 17:06:21 +09:00
Paul Betts
4503aafe64 int32 => int32_t 2016-03-10 17:06:21 +09:00
Cheng Zhao
0aa0efa439 Do not print warning for FILE_ERROR_NOT_FOUND
Close #4282.
2016-01-30 20:49:35 +08:00
Cheng Zhao
899294a040 win: Don't close the handle since we already closed the fd
Fix #4266.
2016-01-30 11:47:22 +08:00
Cheng Zhao
516b01e398 win: Call _close before close file handle
Fix #4258.
2016-01-28 22:38:53 +08:00
Eran Tiktin
85449e953e Fix Windows crash when trying to free asar fd 2016-01-16 03:48:07 +02:00
Kevin Sawicki
741d148776 Add missing semicolon 2016-01-15 10:09:19 -08:00
Kevin Sawicki
b119704ea9 Use 2 space indent instead of 3 2016-01-15 10:05:35 -08:00
Ivo Georgiev
7586078d0a Ensure we close FD on Windows 2016-01-15 16:54:29 +02:00
Juan Cruz Viotti
a99c193cf2 🏁 Preserve file extension when extracting from asar
Currently, when calling `copyFileOut`, the original extension from the
file is lost, and a generic `*.tmp` is added instead.

This becomes problematic in the scenario where we use
`child_process.execFile` on a Windows Batch script that lives inside the
`asar` package.

Windows relies on the extension being present in order to interpret the
script accordingly, which results in the following bug because the
operating system doesn't know what do to with this `*.tmp` file:

```
Error: spawn UNKNOWN
```

Steps to reproduce:

1. Create a dummy batch script (test.bat):

```
@echo off
echo "Hello world"
```

2. Create an electron app that attemps to call this script with
`child_process.execFile`:

```js
var child_process = require('child_process');
var path = require('path');

child_process.execFile(path.join(__dirname, 'test.bat'), function(error, stdout) {
    if (error) throw error;
    console.log(stdout);
});
```

3. Package this small application as an asar archive:

```sh
> asar pack mytestapp app.asar
```

4. Execute the application:

```sh
> electron.exe app.asar
```
2015-12-01 14:55:58 -04:00
Cheng Zhao
cfdcfcbd80 Add executable permission in CopyFileOut 2015-11-27 22:06:37 +08:00
Juan Cruz Viotti
585ff9062c 🐛 Fix missing execution permission bit in execFile override
Consider an electron application that uses `execFile` to run a script
that lives within the application code base:

```coffee
child_process = require 'child_process'
child_process.execFile __dirname + '/script.sh', (error) ->
  throw error if error?
```

An application like this will fail when being packaged in an `asar` with
an following error:

```
Error: spawn EACCES
```

Electron overrides certain `fs` functions to make them work within an
`asar` package. In the case of `execFile`, the file to be executed is
extracted from the `asar` package into a temporary file and ran from
there.

The problem is that during the extraction, the original permissions of
the file are lost.

We workaround this by:

1. Extending `asar.stat` to return whether a file is executable or not,
  which is information that's already saved in the `asar` header.

2. Setting execution permissions on the extracted file if the above
  property holds true.

Fixes: https://github.com/atom/electron/issues/3512
2015-11-26 23:30:23 -04:00
Cheng Zhao
9e90ea8734 win: Fix leaking of fd when reading file in asar 2015-09-24 12:11:07 +08:00
Cheng Zhao
45491ca7ab Fix API changes 2015-09-03 17:50:23 +09:00
Cheng Zhao
a2c26b8c74 Fix hanlding trailing slash in asar package, close #2222 2015-07-16 03:49:26 -07:00
Cheng Zhao
01e891652f Fix compilation errors 2015-05-22 15:24:34 +08:00
Cheng Zhao
d8d7e5b9bb Add Archive::GetFD 2015-05-11 11:02:17 +08:00
Cheng Zhao
f8e1dfbbc6 Keep archive's file opened in the archive's whole life time 2015-05-11 10:47:29 +08:00
Cheng Zhao
b5a8cfb704 Recognize asar archive with unpacked files 2015-03-20 20:34:58 +08:00
Kevin Sawicki
b6b6fc3bfd Remove All Rights Reserved after GitHub copyright
Closes #762
2014-10-31 11:17:05 -07:00
Cheng Zhao
301014e4a6 win: asar: Support "\" as path separator 2014-09-30 20:12:48 +08:00
Cheng Zhao
885ac53a48 asar: Add support in fs.realpathSync 2014-09-30 14:53:58 +08:00
Cheng Zhao
3c412e1cb8 Fix readdir on a linked directory 2014-09-29 15:23:28 +08:00
Cheng Zhao
cebafeae40 Fix getting file from symbol linked directory. 2014-09-28 22:46:29 +08:00
Cheng Zhao
4006b6407c Just use plain pointer for weak reference. 2014-09-25 20:38:12 +08:00
Cheng Zhao
c95a93ef1c Add a way to copy a file in archive into filesystem. 2014-09-25 16:56:50 +08:00
Cheng Zhao
e5e1e207b6 Also search for app.asar when starting app. 2014-09-24 20:09:41 +08:00
Cheng Zhao
0cab034dab Make fs.readdir support asar package. 2014-09-24 18:44:00 +08:00
Cheng Zhao
fa287c2422 Fix getting information for root. 2014-09-24 13:42:04 +08:00
Cheng Zhao
8199ad2ae6 Add asar.stat method. 2014-09-24 12:02:33 +08:00
Cheng Zhao
b01db4aa09 Send file content in asar:// 2014-09-23 20:30:07 +08:00
Cheng Zhao
6d712da7e3 Read the archive's header when there is a url request 2014-09-23 19:14:30 +08:00