CloudServices/Sync/FxSync/Archived/Attic

From MozillaWiki
Jump to: navigation, search

Outdated links

See Labs/Weave/AddDataType for information on how to add new data types to Weave for synchronization.

See Labs/Weave/ReferenceServer for information on the reference Weave server, which is useful to use when doing Weave client development.

Old code

This is a place to dump useful code that was removed from the Weave codebase because it was no longer required, but may still be useful elsewhere.

runCmd

runCmd: function Weave_runCmd() {
    var binary;
    var args = [];
    
    for (let i = 0; i < arguments.length; ++i) {
      args.push(arguments[i]);
    }

    if (args[0] instanceof Ci.nsIFile) {
      binary = args.shift();
    } else {
      binary = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
      binary.initWithPath(args.shift());
    }

    var p = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
    p.init(binary);

    let log = Log4Moz.Service.getLogger("Service.Util");
    log.debug("Running command: " + binary.path + " " + args.join(" "));

    p.run(true, args, args.length);
    return p.exitValue;
}