Skip to content

Commit

Permalink
1.2.1: Fixes rename in Emscripten environment.
Browse files Browse the repository at this point in the history
Previously, we were not appropriately updating the Node object for renamed files,
causing certain Emscripten-compiled programs to fail.
  • Loading branch information
John Vilk committed Mar 18, 2017
1 parent 5b33a3b commit 5b6388d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# BrowserFS v1.2.0
# BrowserFS v1.2.1
> BrowserFS is an in-browser file system that emulates the [Node JS file system API](http://nodejs.org/api/fs.html) and supports storing and retrieving files from various backends. BrowserFS also integrates nicely into the Emscripten file system.
[![Build Status](https://travis-ci.org/jvilk/BrowserFS.svg?branch=master)](https://travis-ci.org/jvilk/BrowserFS)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "browserfs",
"version": "1.2.0",
"version": "1.2.1",
"description": "A filesystem in your browser!",
"main": "dist/browserfs.js",
"typings": "dist/browserfs",
Expand Down
3 changes: 1 addition & 2 deletions src/backend/HTML5FS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,7 @@ export default class HTML5FS extends BaseFileSystem implements IFileSystem {
}

/**
* Returns a BrowserFS object representing a File, created from the data
* returned by calls to the Dropbox API.
* Returns a BrowserFS object representing a File.
*/
private _makeFile(path: string, entry: FileEntry, flag: FileFlag, stat: File, data: ArrayBuffer = new ArrayBuffer(0)): HTML5FSFile {
const stats = new Stats(FileType.FILE, stat.size);
Expand Down
4 changes: 4 additions & 0 deletions src/generic/emscripten_fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ class BFSEmscriptenNodeOps implements EmscriptenNodeOps {
const newPath = this.PATH.join2(this.fs.realPath(newDir), newName);
try {
this.nodefs.renameSync(oldPath, newPath);
// This logic is missing from the original NodeFS,
// causing Emscripten's filesystem to think that the old file still exists.
oldNode.name = newName;
oldNode.parent = newDir;
} catch (e) {
if (!e.code) {
throw e;
Expand Down

0 comments on commit 5b6388d

Please sign in to comment.