Chameleon Applications

Chameleon Applications Commit Details

Date:2011-12-03 03:20:48 (8 years 10 months ago)
Author:Rekursor
Commit:380
Parents: 379
Message:Fixed authorization on Lion preventing app level preferences to be saved
Changes:
M/trunk/ChameleonPrefPane/Sources/PropertyList.cpp
M/trunk/ChameleonPrefPane/bin/OSX106/Chameleon.zip
M/trunk/ChameleonPrefPane/Sources/ChameleonPrefPane.mm
M/trunk/ChameleonPrefPane/bin/version

File differences

trunk/ChameleonPrefPane/Sources/ChameleonPrefPane.mm
7676
7777
7878
79
8079
81
80
8281
8382
83
8484
85
86
87
88
85
86
87
88
89
90
91
8992
9093
9194
//--------------------------------------------------------------------------
-(bool) savePreferences: (NSDictionary*) dict
{
std::string sPath = [kPreferencesFilePath UTF8String];
if(dict==nil || sPath.length()==0) return false;
if(dict==nil) return false;
AuthorizationRef auth = [self isUnlocked] ? [[authView authorization] authorizationRef] : NULL;
if (!auth) return false;
PropertyList::chmodFile(sPath.c_str(), "0777", auth);
[dict writeToFile:kPreferencesFilePath atomically:YES];
PropertyList::chmodFile(sPath.c_str(), "0644", auth);
return true;
NSString* tmpPropName = @"/tmp/chamPrefPane.plist";
BOOL ret = [dict writeToFile:tmpPropName atomically:YES];
if (!ret) return false;
NSString* args = [NSString stringWithFormat:@"%@ %@", tmpPropName, kPreferencesFilePath];
const char * cArgs = [args UTF8String];
ret = executePrivilegedCmd(auth, "/bin/cp", cArgs , NULL);
return ret;
}
//--------------------------------------------------------------------------
trunk/ChameleonPrefPane/Sources/PropertyList.cpp
138138
139139
140140
141
142
143
141144
142145
143146
std::string args = chmodMask;
args += ' ';
args += path;
struct stat st;
if (stat(path,&st)!=0)
executePrivilegedCmd(auth, "/usr/bin/touch", path, flags);
if(!executePrivilegedCmd(auth, "/bin/chmod", args.c_str(), flags))
return false;
}
trunk/ChameleonPrefPane/bin/version
1
1
r378
r380

Archive Download the corresponding diff file

Revision: 380