Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying a version number?



Thanks, that works perfectly!


On May 12, 2005, at 1:26 PM, Guy Brooker wrote:




Niels Meersschaert <email@hidden> wrote:


That does seem like it would be easier, since the plist isn't in a parental
element format. ie key & string are siblings & causes lots of fun creating a
proper parser. But, the code you gave isn't working in my widget. I even
tried getting the defaults directly from Terminal after cding into the wdgt
directory & running


defaults read `pwd`/InfoCFBundleShortVersionString



Look like entourage removed a space in my copy paste.

defaults read `pwd`/Info CFBundleShortVersionString
                       ^^^^

I've attached a working .js so there should be no other errors introduced on
the way !


Cheers
Guy


I read the man page & tried a few variations, including using the
CFBundleIdentifier string as the domain & altering
InfoCFBundleShortVersionString to CFBundleShortVersionString as the key, but
kept getting a message that the domain didn't exist.


Incidentally, in my testing I did find that if you can see what preferences
you've set by this format:


defaults read widget-CFBundleIdentifier, where CFBundleIdentifier is the
string you placed in your Info.plist.


So, perhaps defaults can only be used for the preferences of an app, not it's
default plist file?


On May 12, 2005, at 2:50 AM, Guy Brooker wrote:


Niels,

Here is a much easier way of getting your version number :

ver = widget.system(
  'sh -c "defaults read `pwd`/InfoCFBundleShortVersionString"'
  ,null).outputString);

You'll need

    AllowSystem = 1;

In your Info.plist

Cheers,
Guy

Niels Meersschaert <email@hidden> wrote:



When I tried this using the syntax:
plist = new XMLHttpRequest();
plist.open("GET","version.plist",true);
my async listener reported a status != 200 with a statusText of undefined.
The responseText was null, and the responseXML contained no nodes.


Are we sure you can use relative urls referencing files inside the wdgt
bundle, or did I mess up on my syntax?





Say you want to display a version number on the backside
of the widget (is this a bad idea or good idea?), then
what's the easiest way to get the value of the
CFBundleShortVersionString key of the Info.plist
file of our widget bundle?


Or should we just rely on the Get Info command of the Finder?




I would just let the user use Get Info.

If you feel you must have it, you can sue the XMLHttpRequest object to get
your info.plist and parse it. You can pass relative urls to
XMLHttpRequest.


On the other hand you could hard code it in your HTML, and update the
version when you update your widget.


Thanks,
jl

--------------------------------------------------
John Louch         Internet #: email@hidden
(805) 541 2965




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/guy.brooker% 40free.fr


This email sent to email@hidden













<version.js>


_______________________________________________ Do not post admin requests to the list. They will be ignored. Dashboard-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Displaying a version number? (From: Guy Brooker <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.