1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-09 03:54:11 +01:00

Don't overwrite existing files with ;s.

Closes issue #914.
This commit is contained in:
Doug Kearns
2012-10-11 00:59:44 +11:00
parent 0a51732d0e
commit 50597cc80a
3 changed files with 7 additions and 1 deletions

View File

@@ -585,8 +585,9 @@ var Buffer = Module("Buffer", {
* Saves a page link to disk.
*
* @param {HTMLAnchorElement} elem The page link to save.
* @param {boolean} overwrite If true, overwrite any existing file.
*/
saveLink: function saveLink(elem) {
saveLink: function saveLink(elem, overwrite) {
let { completion, dactyl, io } = this.modules;
let self = this;
@@ -604,6 +605,8 @@ var Buffer = Module("Buffer", {
if (file.exists() && file.isDirectory())
file.append(Buffer.getDefaultNames(elem)[0][0]);
util.assert(!file.exists() || overwrite, _("io.existsNoOverride", file.path));
try {
if (!file.exists())
file.create(File.NORMAL_FILE_TYPE, octal(644));