mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 00:17:58 +01:00
move global fopen() to a slot in vimperator
This commit is contained in:
@@ -1236,7 +1236,7 @@ function isDirectory(url)
|
|||||||
if (url.match(/^file:\/\//) || url.match(/^\//))
|
if (url.match(/^file:\/\//) || url.match(/^\//))
|
||||||
{
|
{
|
||||||
var stripedFilename = url.replace(/^(file:\/\/)?(.*)/, "$2");
|
var stripedFilename = url.replace(/^(file:\/\/)?(.*)/, "$2");
|
||||||
var file = fopen(stripedFilename, '<');
|
var file = vimperator.fopen(stripedFilename, '<');
|
||||||
if (!file)
|
if (!file)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ function get_file_completions(filter) //{{{
|
|||||||
|
|
||||||
var compl = match[2] || '';
|
var compl = match[2] || '';
|
||||||
try {
|
try {
|
||||||
var fd = fopen(dir, "<");
|
var fd = vimperator.fopen(dir, "<");
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
// thrown if file does not exist
|
// thrown if file does not exist
|
||||||
return [ ];
|
return [ ];
|
||||||
|
|||||||
@@ -41,11 +41,6 @@ const MODE_SYNC = 0x40;
|
|||||||
const MODE_EXCL = 0x80;
|
const MODE_EXCL = 0x80;
|
||||||
|
|
||||||
|
|
||||||
function fopen (path, mode, perms, tmp)
|
|
||||||
{
|
|
||||||
return new LocalFile(path, mode, perms, tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
function LocalFile(file, mode, perms, tmp) // {{{
|
function LocalFile(file, mode, perms, tmp) // {{{
|
||||||
{
|
{
|
||||||
const classes = Components.classes;
|
const classes = Components.classes;
|
||||||
|
|||||||
@@ -249,6 +249,11 @@ const vimperator = (function() //{{{
|
|||||||
content.focus(); // FIXME: shouldn't be window.document.content?
|
content.focus(); // FIXME: shouldn't be window.document.content?
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fopen: function(path, mode, perms, tmp)
|
||||||
|
{
|
||||||
|
return new LocalFile(path, mode, perms, tmp);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* logs a message to the javascript error console
|
* logs a message to the javascript error console
|
||||||
*/
|
*/
|
||||||
@@ -514,7 +519,7 @@ const vimperator = (function() //{{{
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var fd = fopen(filename, "<");
|
var fd = vimperator.fopen(filename, "<");
|
||||||
if (!fd)
|
if (!fd)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -649,7 +654,7 @@ const vimperator = (function() //{{{
|
|||||||
// also source plugins in ~/.vimperator/plugin/
|
// also source plugins in ~/.vimperator/plugin/
|
||||||
var entries = [];
|
var entries = [];
|
||||||
try {
|
try {
|
||||||
var fd = fopen("~/.vimperator/plugin", "<");
|
var fd = vimperator.fopen("~/.vimperator/plugin", "<");
|
||||||
var entries = fd.read();
|
var entries = fd.read();
|
||||||
fd.close();
|
fd.close();
|
||||||
entries.forEach(function(file) {
|
entries.forEach(function(file) {
|
||||||
|
|||||||
Reference in New Issue
Block a user