SHARE
TWEET

Felix

a guest Jan 9th, 2009 252 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- downbar.js.orig     2009-01-09 14:13:30.000000000 +0100
  2. +++ downbar.js  2009-01-09 14:10:56.000000000 +0100
  3.  -257,6 +257,7 @@
  4.                
  5.                 this.db_dlCompleteSound(db_fileext);
  6.                
  7. +               this.db_SetMetadata(dl);
  8.                 this.db_AntiVirusScan(elmpath, db_fileext);
  9.                
  10.                 var db_pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
  11.  -405,6 +406,21 @@
  12.                
  13.         },
  14.  
  15. +    db_SetMetadata: function(aDownload) {
  16. +        var cmd = '/usr/bin/xattr'
  17. +        var execFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
  18. +        var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
  19. +        
  20. +        // Arguments must be separated into an array
  21. +        var args = ['-w', 'com.apple.metadata:kMDItemWhereFroms', "'"+aDownload.source.spec+"'", aDownload.targetFile.path ];
  22. +        
  23. +        execFile.initWithPath(cmd);
  24. +        if (execFile.exists()) {
  25. +            process.init(execFile);
  26. +            process.run(false, args, args.length);
  27. +        }
  28. +    },
  29. +      
  30.         db_AntiVirusScan : function(filepath, db_fileext) {
  31.                
  32.                 //var acs = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
RAW Paste Data
Challenge yourself this year...
Learn something new in 2017
Top