Index: lang/javascript/vimperator-plugins/trunk/fetchyoutube.js
===================================================================
--- lang/javascript/vimperator-plugins/trunk/fetchyoutube.js (revision 24132)
+++ lang/javascript/vimperator-plugins/trunk/fetchyoutube.js (revision 24155)
@@ -19,22 +19,23 @@
 (function () {
 
-    function fetch () {
-      function fixFilename (filename) {
-        const badChars = /[\\\/:;\*\?\"\<\>\|]/g;
-        return filename.replace(badChars, '_');
-      }
+    function fixFilename (filename) {
+      const badChars = /[\\\/:;\*\?\"\<\>\|]/g;
+      return filename.replace(badChars, '_');
+    }
 
-      function makeFile (s) {
-        var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
-        file.initWithPath(s);
-        return file;
-      }
+    function makeFile (s) {
+      var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+      file.initWithPath(s);
+      return file;
+    }
 
-      function makeURL (s) {
-        var url = Cc["@mozilla.org/network/standard-url;1"].createInstance(Ci.nsIURL);
-        url.spec = s;
-        return url;
-      }
+    function makeURL (s) {
+      var url = Cc["@mozilla.org/network/standard-url;1"].createInstance(Ci.nsIURL);
+      url.spec = s;
+      return url;
+    }
 
+    function fetch (arg) {
+      let filepath = arg.string;
       let dir = options.getPref('browser.download.dir');
       let as = content.document.defaultView.wrappedJSObject.swfArgs;
@@ -48,7 +49,18 @@
       let wbp = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(Ci.nsIWebBrowserPersist);
 
-      let file = dm.userDownloadsDirectory;
-      file.appendRelativePath(title + '.mp4');
+      let file;
+      if (filepath) {
+        filepath = io.expandPath(filepath);
+        file = io.getFile(filepath);
+        if (file.isDirectory())
+          file.appendRelativePath(title + '.mp4');
+      } else {
+        file = dm.userDownloadsDirectory;
+        file.appendRelativePath(title + '.mp4');
+      }
+      if (file.exists())
+        return liberator.echoerr('The file already exists! -> ' + file.path);
       file = makeFileURI(file);
+
 
       let dl = dm.addDownload(0, makeURL(url, null, null), file, title, null, null, null, null, wbp);
@@ -60,5 +72,11 @@
     //fetch();
 
-    commands.addUserCommand(['fetchyoutube', 'fetchyt'], 'fecth youtube HD video', fetch, {}, true);
+    commands.addUserCommand(
+      ['fetchyoutube', 'fetchyt'],
+      'fecth youtube HD video',
+      fetch,
+      {argCount: '*', completer: completion.file},
+      true
+    );
 
 })();
