Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Reading from Info.plist (CFBundleVersion)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reading from Info.plist (CFBundleVersion)



Hi all!

I've seen that reading values from a widget Info.plist file has been discussed here. As far as I can see there are two ways of doing it:

* Using XMLHttpRequest to read Info.plist and parse it.
* Using widget.system and "defaults read".

Both ways seem a little odd to me, I was hoping for something like widget.getInfo("CFBundleVersion"), widget.getVersion() or widget.version.

I am using the widget system call, here is my function:

// return widget version and make sure that it looks like "#.#"
// on error return "0.0"
function getWidgetVersion()
{
	var queryVersion = widget && widget.system(
			"/usr/bin/defaults read " +
			window.location.pathname.replace(/[^/]*$/, "Info") +
			" CFBundleVersion", null);

	return queryVersion && (queryVersion.status == 0)
		&& queryVersion.outputString.match(/^\d.\d$/)
		|| "0.0";
}


Are there other (better) ways of getting the widget version?

Thank you and best regards!


_________________________________________________________________
Drück deine Gefühle aus! Hol dir 30 GRATIS Emoticons für den Windows Live Messenger!
http://get.live.com _______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.