mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 16:47:58 +01:00
Remove silly type checking from io.{read,write}File.
This commit is contained in:
@@ -725,8 +725,6 @@ function IO() //{{{
|
|||||||
{
|
{
|
||||||
if (typeof dir == "string")
|
if (typeof dir == "string")
|
||||||
dir = self.getFile(dir);
|
dir = self.getFile(dir);
|
||||||
else if (!(dir instanceof Ci.nsILocalFile))
|
|
||||||
throw Cr.NS_ERROR_INVALID_ARG; // FIXME: does not work as expected, just shows undefined: undefined
|
|
||||||
|
|
||||||
if (dir.isDirectory())
|
if (dir.isDirectory())
|
||||||
{
|
{
|
||||||
@@ -762,9 +760,6 @@ function IO() //{{{
|
|||||||
encoding = options["fileencoding"];
|
encoding = options["fileencoding"];
|
||||||
if (typeof file == "string")
|
if (typeof file == "string")
|
||||||
file = self.getFile(file);
|
file = self.getFile(file);
|
||||||
else if (!(file instanceof Ci.nsILocalFile))
|
|
||||||
throw Cr.NS_ERROR_INVALID_ARG; // FIXME: does not work as expected, just shows undefined: undefined
|
|
||||||
// How would you expect it to work? It's an integer. --Kris
|
|
||||||
|
|
||||||
ifstream.init(file, -1, 0, 0);
|
ifstream.init(file, -1, 0, 0);
|
||||||
icstream.init(ifstream, encoding, 4096, Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER); // 4096 bytes buffering
|
icstream.init(ifstream, encoding, 4096, Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER); // 4096 bytes buffering
|
||||||
@@ -818,8 +813,6 @@ function IO() //{{{
|
|||||||
encoding = options["fileencoding"];
|
encoding = options["fileencoding"];
|
||||||
if (typeof file == "string")
|
if (typeof file == "string")
|
||||||
file = self.getFile(file);
|
file = self.getFile(file);
|
||||||
else if (!(file instanceof Ci.nsILocalFile))
|
|
||||||
throw Cr.NS_ERROR_INVALID_ARG; // FIXME: does not work as expected, just shows undefined: undefined
|
|
||||||
|
|
||||||
if (mode == ">>")
|
if (mode == ">>")
|
||||||
mode = self.MODE_WRONLY | self.MODE_CREATE | self.MODE_APPEND;
|
mode = self.MODE_WRONLY | self.MODE_CREATE | self.MODE_APPEND;
|
||||||
|
|||||||
Reference in New Issue
Block a user