|
#1
| |||
| |||
| Needing help with a script I have asked 2 questions before and both times when I asked them I was given good pointers but ended up figure it out myself. I am here once again in an attempt to ask a question and hopefully be able to solve it with your help. What I am looking for is a way to install your choice of 1 to 26 items at a time (installing multiple from the list if so choose) with a switch at the bottom to allow you to select all of them. I will need to run a check of the os since the files that need to be checked for are in 2 different spots in 10.4 and 10.5 run down on what i need: - Check the os version and place it in the variable - check if a file exists in the folder, if not, then copy it there - a way to install the items that the user selects I am attempting to use xcode, however, I was wondering if there is a better program to use. I know that i will need to have an array to copy the items to so it will be read into. Please help me or point me in the right direction again. |
|
#2
| ||||
| ||||
| Have you considered building a package for use with the standard Installer.app? It sounds like what you need is what that was built for. I have little experience with it, though, so I'm not sure exactly how you'd rig it up. If you want to deal with XCode, you can use the methods detailed at Cocoa Dev Central for testing which Mac OS version the user has. I recommend method #2 on that page. The first one won't work beyond Panther, and the last one is just complicated. To check and copy files, look up NSFileManager. Specifically, the fileExistsAtPath:isDirectory: and copyPath:toPath:handler: methods. |
|
#3
| ||||
| ||||
| Quote:
So for others who find this post and might be looking for more than just the minor revision number, here's a program which uses the original code, and a proposed modification. Output on Tiger (currently 10.4.11) looks like this, where the original method reports the OS as 10.4.9, and the modification shows 10.4.11: 0x1049 10.4.11 Code: // os.c
// Compile with: gcc -o os os.c -framework Carbon
#include <stdio.h>
#include <Carbon/Carbon.h>
void OriginalMethod()
{
SInt32 macVersion = 0;
if (Gestalt(gestaltSystemVersion, &macVersion) == noErr) {
fprintf(stderr,"0x%4x\n", macVersion);
} else {
fprintf(stderr,"Gestalt error\n");
}
}
void ModifiedMethod()
{
SInt32 osVersion[3] = {0, 0, 0};
if (Gestalt(gestaltSystemVersionMajor, &osVersion[0]) ==
Gestalt(gestaltSystemVersionMinor, &osVersion[1]) ==
Gestalt(gestaltSystemVersionBugFix,&osVersion[2]) == noErr) {
fprintf(stderr,"%d.%d.%d\n", osVersion[0], osVersion[1], osVersion[2]);
} else {
fprintf(stderr,"Gestalt error\n");
}
}
int main(void)
{
OriginalMethod();
ModifiedMethod();
} Quote:
Code: <string>Mac OS X</string>
<key>ProductUserVisibleVersion</key>
<string>10.4.11</string>
<key>ProductVersion</key>
<string>10.4.11</string> Last edited by macbri; March 30th, 2008 at 01:29 PM. Reason: Extra info |
![]() |
| Thread Tools | |
|
|