Jump to content

Request: getSP() [fetch service pack level]


Recommended Posts

I've made good use of getOSver() to stop things installing where they shouldn't (or, more correctly, where they will fail to install and spoil the UA). I've come across a few products that need a finer granularity, such as Tiny Personal Firewall, which needs W2K >= SP3 or WXP >= SP1 (or something along those lines ... at least the install is good enough to tell me exactly what it wants!).

So I'd like to ask for a getServicePack() [or getSP() or whatever] function to go with getOSver().

It looks like checking CSDVersion would do (it ways "Service Pack 2" on WXP SP2, the function should probably return "0", "1", "2" etc.).

Any chance of that being added to api.js?

If not (I know I sometimes ask for silly stuff :-)) where is the best place for me to define my own code so that I simultaneously make the smallest number of changes and maximise my chances of upgrading WPI seamlessly without losing my enhancement?

Thanks.

Link to comment
Share on other sites


To answer that very last question: Create a new .js file.

You're simply talking about a javascript function. You can then call the javascript function from anywhere else, just as long as the dependencies are met. I, personally, would put it in config.js, and then the gcond could include certain service packs, OSes, and whatnot (instead of just "if file exists"), plus you don't have to worry about having to change the file when you upgrade (since config.js doesn't seem to change much).

Link to comment
Share on other sites

Definetly do not put it in config.js. Don't put anything in there. Put it in api.js with getOSver(). Or just build it in with getOSver().

That is a good idea. On to my To Do List it goes. If you get done first, let me know and we can merge codes.

Link to comment
Share on other sites

Added new function: getSPver() to get the Service Pack value. It returns 1, 2, 3.......etc. or "Not found" like getOSver().

Excellent. Many thanks for that. I didn't post mine because I was testing it out on W2K and WXP, but yours is better any way :-)

Link to comment
Share on other sites

Definetly do not put it in config.js. Don't put anything in there. Put it in api.js with getOSver(). Or just build it in with getOSver().

That is a good idea. On to my To Do List it goes. If you get done first, let me know and we can merge codes.

Just out of curiosity, why is this? Is config.js parsed by line number or something? I just assumed you used regex to parse code from it. And it's also the most constant file (I've had the same config.js file for the past 8 months ... with only adding the new pcmd as of recently).

Anyway, just wondering why it can't be put in there. :)

PS-

Gonna PM that code you wanted right now (so check your PM if you haven't already).

Link to comment
Share on other sites

It's the most consistent file because I didn't want to break everyone's existing config file. You shouldn't put anything in there because every time WPI saves the config it will overwrite/create a new file.

Put a comment line at the top like

// Dumpy Dooby was here!

from a text editor. Open WPI and save the config file. It will be gone. If you NEVER use WPI to edit/save your config.js then fine.

Link to comment
Share on other sites

Oh, that's what I figured you were going to say. I said, "I, personally" because I don't use WPI to edit my config. I used it once, and from then on, I've just used notepad to do it. I knew it overwrites the file, though.

Although your point still stands; it was irresponsible of me to recommend putting it into config.js without noting the problem with doing that. I just assumed nobody changes their config.js ... like me, which of course, was probably a silly assumption. :P

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...