Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get rid of global Showtime object and use modules named native/* to e…
…xport C functions
- Loading branch information
Showing
29 changed files
with
438 additions
and
428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
|
||
|
||
exports.writeFileSync = function(filename, data, opts) { | ||
var fd = Showtime.fs.open(filename, 'w'); | ||
var fs = require('native/fs'); | ||
var fd = fs.open(filename, 'w'); | ||
try { | ||
Showtime.fs.write(fd, data, 0, data.length, 0); | ||
fs.write(fd, data, 0, data.length, 0); | ||
} | ||
finally { | ||
Showtime.resourceDestroy(fd); | ||
Core.resourceDestroy(fd); | ||
} | ||
} | ||
|
||
exports.readFileSync = function(filename, opts) { | ||
var fd = Showtime.fs.open(filename, 'r'); | ||
var fd = fs.open(filename, 'r'); | ||
try { | ||
var buf = new Duktape.Buffer(Showtime.fs.fsize(fd)); | ||
Showtime.fs.read(fd, buf.valueOf(), 0, buf.length, 0); | ||
var buf = new Duktape.Buffer(fs.fsize(fd)); | ||
fs.read(fd, buf.valueOf(), 0, buf.length, 0); | ||
return buf; | ||
} finally { | ||
Showtime.resourceDestroy(fd); | ||
Core.resourceDestroy(fd); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.