Bug 723 : Suggestion: Registry lookups using reflection
Last modified: 2008-06-05 08:20



Assigned To:

Attachment Type Created Size Actions

Description:   Opened: 2008-02-09 01:44
revision 0135

I thought this might be interesting for you: I'm working on Fritzing and
since we are trying to mimick the behaviour of Processing/Arduino, we are
sometimes looking into your code to see how you did it.
In the case of the registry lookups that you're doing for finding the
user's document folder etc. (in Base.getDefaultSketchbookFolder()) we first
took over your code but then ran into some problems with a changed API on
Mac and the dll dependency for Windows.
We changed this to just use reflection and updated the Mac version to a
newer API. This way you don't need the extra jars and the dll, and it might
also solve some of the other registry-related bugs that I've seen reported
Take a look at getFritzingUserFolder() in

We will let you know when we hit more spots!

andré from the Fritzing team, standing on the shoulders of giants
Additional Comment #1 From fry 2008-02-11 13:03
cool, thanks for the heads up, that's really helpful. might even be time to
move that registry stuff to JNA, since the current API has some problems
(i18n being the biggest one--it mangles and byte swaps unicode characters).
Additional Comment #2 From andre 2008-02-12 07:18
You're welcome. :)

I had not heard of JNA and looked it up, looks really promising. There's
also already a Windows registry binding example:

Of course we haven't tried our variation on unicode yet.. -- but also did
not get any complaints yet, so we'll see.
Additional Comment #3 From fry 2008-06-04 11:36
is the macosx version any different? the deal with BaseMacOS is that on OS
X you need a separate application listener class to handle events like
files double-clicked from the Finder. i just made one reflection change for
osx so that you can build without BaseMacOS entirely (and therefore don't
need the apple.jar stubs file on other platforms), though excluding
BaseMacOS.java is kind of tricky unless we put it in a subfolder.

now looking into the jna stuff...
Additional Comment #4 From fry 2008-06-05 08:20
reworked how platforms are handled by Base, each of the major platforms now
has their own package. removed the nasty jnireg and dll stuff, and moved
all of that to use JNA for release 0140. much better, much cleaner setup.

(note that svn for this will be bumpy for a few days as i update all the
build scripts)