Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fp.show(function(x) {
// Check if the user selected nothing.
if (!x) {
return;
}
console.log("you picked " + x.length + " files");
for (var i = 0; i < x.length; i++) {
currentFile = "" + x[i];
stringData = require("file").read(currentFile);
editorSession.setValue(stringData);
}
});
}
updateMemory: function() {
let path = getStoragePath();
// update storage if the file
// does not exist or is older than we want
if (!file.exists(path) ||
(getUnixTimeStamp()-
getLastModificationTime(path)/1000>=STORAGE_UPDATE_INTERVAL)) {
cps.updateStorage();
return;
}
let str = file.read(path);
cps.pool = JSON.parse(str);
cps.last_update = getUnixTimeStamp();
},
/**
function installAndRun(installPath, xpiPath) {
// TODO: If the XPI is corrupted, Firefox will crash. Figure out how
// to bail gracefully.
if (file.exists(installPath))
shellUtils.removeDirRecursive(installPath);
shellUtils.makeDir(installPath);
var zip = require("zip-file").open(xpiPath);
zip.extractAll(installPath);
var manifestFile = file.join(installPath, "harness-options.json");
var manifest = JSON.parse(file.read(manifestFile));
return {
id: manifest.jetpackID,
__proto__: require("bootstrap").run(manifest, installPath, print)
};
}
Application.prototype.findJakefileLocation = function() {
var directory = FILE.cwd();
var filename = null;
while (!(filename = this.hasJakefile(directory)) && directory !== "/")// && !this._options.nosearch)
directory = FILE.absolute(FILE.join(directory, ".."));
if (!filename)
return null;
return [filename, directory];
}
ApplicationTask.prototype.defineCacheManifestTask = function()
{
if (!this.shouldGenerateCacheManifest())
return;
var productPath = FILE.join(this.buildProductPath(), "");
var indexFilePath = this.buildIndexFilePath();
// TODO: can we conditionally generate based on outdated files?
var manifestPath = FILE.join(productPath, "app.manifest");
Jake.task(manifestPath, function() {
require("../cache-manifest").generateManifest(productPath, { index : indexFilePath });
});
this.enhance([manifestPath]);
}
CFPropertyList.modifyPlist(buildNative.join("Contents", "Info.plist"), function(plist) {
plist.setValueForKey("CFBundleName", defaultBundleName);
plist.setValueForKey("NHInitialResource", FILE.join(rootBaseName, options.index));
// merge Cappuccino plist
var cappPlistPath = rootPath.join("Info.plist");
if (cappPlistPath.isFile())
mergePlist(plist, cappPlistPath);
if (options.extraPlistPath)
mergePlist(plist, options.extraPlistPath);
});
}
exports["test " + hamlFile] = function() {
var scopeFile = hamlFile.replace(/haml$/, "js");
var htmlFile = hamlFile.replace(/haml$/, "html");
var haml = FILE.read(hamlFile);
var expected = FILE.read(htmlFile);
var scope = FILE.exists(scopeFile) ? eval("("+FILE.read(scopeFile)+")") : {};
var js = Haml.compile(haml);
var js_opt = Haml.optimize(js);
var actual = Haml.execute(js_opt, scope.context, scope.locals);
ASSERT.equal(actual.trim(), expected.trim());
}
});
exports.main = function commonjsMain(args) {
if (!args[1])
throw new Error('Usage: '+args[0]+' FILE');
if (typeof process !== 'undefined') {
var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8");
} else {
var cwd = require("file").path(require("file").cwd());
var source = cwd.join(args[1]).read({charset: "utf-8"});
}
return exports.parser.parse(source);
}
if (typeof module !== 'undefined' && require.main === module) {
exports.main = function commonjsMain(args) {
if (!args[1]) throw new Error('Usage: ' + args[0] + ' FILE');
if (typeof process !== 'undefined') {
var source = require('fs').readFileSync(
require('path').join(process.cwd(), args[1]),
'utf8',
);
} else {
var cwd = require('file').path(require('file').cwd());
var source = cwd.join(args[1]).read({charset: 'utf-8'});
}
return exports.parser.parse(source);
};
exports.main = function commonjsMain(args) {
if (!args[1])
throw new Error('Usage: '+args[0]+' FILE');
if (typeof process !== 'undefined') {
var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8");
} else {
var cwd = require("file").path(require("file").cwd());
var source = cwd.join(args[1]).read({charset: "utf-8"});
}
return exports.parser.parse(source);
}
if (typeof module !== 'undefined' && require.main === module) {