Possible Bindwood Bug?

James Tait james.tait at wyrddreams.org
Fri Feb 12 01:16:54 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I'm working on an extension for Thunderbird to sync its contacts with
DesktopCouch.  It's based heavily on the Bindwood code.  In the course
of my poking around, I noticed the following lines in sync.js (from line
101):

        // create a randomly named tempfile in the tempdir
        var tmpfile = Cc["@mozilla.org/file/local;1"]
                     .createInstance(Ci.nsILocalFile);
        tmpfile.initWithPath(tmpdir.path + "/desktopcouch." +
Math.random());
        tmpfile.createUnique(tmpfile.NORMAL_FILE_TYPE, 0600);

Now this is the first time I've done any hacking on Mozilla extensions,
so I might be totally wrong, but my understanding is that the above
would not be cross-platform compatible - which would be a shame, as it
would prevent me from syncing my bookmarks between work and home when we
get DesktopCouch working on Windows.  Instead, I've taken the approach
of using the appendRelativePath method of nsILocalFile:

        tmpfile.initWithPath(tmpdir.path);
        tmpfile.appendRelativePath(desktopcouch." + Math.random());

As I said, I'm a complete n00b at this, so if the above is incorrect or
unnecessary then please let me know so I can learn from the experience.

Cheers,

JT
- --
- ---------------------------------------+--------------------------------
James Tait, BSc                        |    xmpp:jayteeuk at wyrddreams.org
Programmer and Free Software advocate  |       VoIP: +44 (0)870 490 2407
- ---------------------------------------+--------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkt0rAYACgkQyDo4xMNTLia8KgCgxAGP0b/KZ7nNby4leyAnCzxB
slYAn2Pg1lNToMCWCwwQEXc6mHjGij+/
=9ay5
-----END PGP SIGNATURE-----




More information about the Ubuntu-devel-discuss mailing list