Граф коммитов

46 Коммитов

Автор SHA1 Сообщение Дата
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
Cheng Zhao c493bec089 Make sure temp file will be cleaned up when base::Move fails 2015-12-02 11:36:29 +08:00
Cheng Zhao c3645e3f95 Don't call Move if there is no need to move 2015-12-02 11:07:48 +08: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
Haojian Wu fc4031ec26 Now the value in ScopedPtrHashMap is required to be scoped_ptr. 2015-08-11 09:48:29 +08: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
Cheng Zhao a8c227d5f5 Fix cpplint warnings 2015-02-12 19:50:28 +08:00
Cheng Zhao 3678f13dfb Make NativeImage work with asar archive 2015-02-12 19:34:21 +08:00
Cheng Zhao 98a7f08be2 Move GetAsarArchivePath to asar_util.h 2015-02-12 17:31:14 +08:00
Cheng Zhao 3b3a025ed4 Move GetsOrCreateAsarArchive to asar_util.h 2015-02-12 17:23:49 +08:00
Cheng Zhao 11cb777e35 win: Delete temp file on reboot, fix #1084 2015-02-02 17:03:52 -08:00
Cheng Zhao 27011ad0c8 win: Fix program not quitting, close #1084 2015-02-02 16:10:48 -08:00
Cheng Zhao 750db6aed8 base/file_util.h has been moved to base/files/file_util.h 2015-01-27 13:18:30 -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 38f83cacf9 Make some APIs work with archive.copyFileOut API. 2014-09-25 23:25:17 +08:00
Cheng Zhao c49a44f944 Remove unneeded ArchiveFactory. 2014-09-25 21:54:59 +08:00
Cheng Zhao dbbfef38b1 Cache asar archives on JavaScript side. 2014-09-25 20:48:32 +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 0d09143a77 Add JavaScript bindings of asar::Archive. 2014-09-24 11:10:07 +08:00
Cheng Zhao 7081f7799b Separate the archive cache out to ArchiveFactory. 2014-09-23 22:31:45 +08:00
Cheng Zhao b6583635d4 Caching the Archive object. 2014-09-23 21:48:40 +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