SHARE
TWEET

xattr patch for 0.9.7.1

a guest Sep 17th, 2010 160 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- downbar.js.orig     2010-09-17 19:48:24.000000000 +0200
  2. +++ downbar.js  2010-09-17 19:58:41.000000000 +0200
  3. @@ -259,6 +259,22 @@
  4.                         win._dlbar_startUpdateMini();
  5.                 }
  6.      },
  7. +
  8. +    _dlbar_SetMetadata: function(aDownload) {
  9. +        var cmd = '/usr/bin/xattr'
  10. +        var execFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
  11. +        var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
  12. +
  13. +        // Arguments must be separated into an array
  14. +        var args = ['-w', 'com.apple.metadata:kMDItemWhereFroms', "'"+aDownload.source.spec+"'", aDownload.targetFile.path ];
  15. +
  16. +        execFile.initWithPath(cmd);
  17. +        if (execFile.exists()) {
  18. +            process.init(execFile);
  19. +            process.run(false, args, args.length);
  20. +        }
  21. +    },
  22. +
  23.      
  24.      _dlbar_finishDownload : function(dl) {
  25.        
  26. @@ -266,9 +282,9 @@
  27.                 //var fixedelmpath = elmpath.replace(/\\/g, "\\\\");  // The \ and ' get messed up in the command if they are not fixed
  28.                 //fixedelmpath = fixedelmpath.replace(/\'/g, "\\\'");
  29.                 var _dlbar_fileext = elmpath.split(".").pop().toLowerCase();
  30.                
  31. +               this._dlbar_SetMetadata(dl);
  32. +
  33.                 this._dlbar_dlCompleteSound(_dlbar_fileext);
  34.                
  35.                 this._dlbar_AntiVirusScan(elmpath, _dlbar_fileext);
RAW Paste Data
Top