Skip to content
This repository has been archived by the owner on Jul 18, 2019. It is now read-only.

Commit

Permalink
Merge branch 'release/EasySIMBL-1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
norio-nomura committed Nov 11, 2012
2 parents 243b503 + f97d70f commit 3f937f0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 28 deletions.
4 changes: 2 additions & 2 deletions EasySIMBL/EasySIMBL-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3</string>
<string>1.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>5</string>
<string>6</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Changes from [original SIMBL](http://www.culater.net/software/SIMBL/SIMBL.php)

How to install
--------------
1. Download [EasySIMBL-1.3.zip](http://github.com/downloads/norio-nomura/EasySIMBL/EasySIMBL-1.3.zip) (2012/10/04 updated)
1. Download [EasySIMBL-1.4.zip](http://github.com/downloads/norio-nomura/EasySIMBL/EasySIMBL-1.4.zip) (2012/11/11 updated)
2. Extract and move `EasySIMBL.app` into `/Applications` or `~/Applications`.
3. Launch `EasySIMBL.app` and make check `Use SIMBL`, then quit `EasySIMBL.app`.

Expand Down
58 changes: 35 additions & 23 deletions SIMBL Agent/SIMBLAgent.m
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ - (void) receiveSIMBLHasBeenLoadedNotification:(NSNotification*)notification
self.waitingInjectionNumber--;
if (!self.waitingInjectionNumber) {
NSError *error = nil;
[[NSFileManager defaultManager]removeItemAtPath:self.linkedOsaxPath error:&error];
if (error) {
if (![[NSFileManager defaultManager]removeItemAtPath:self.linkedOsaxPath error:&error]) {
SIMBLLogNotice(@"removeItemAtPath error:%@",error);
}
}
Expand Down Expand Up @@ -162,11 +161,8 @@ - (void) injectSIMBL:(NSRunningApplication *)runningApp
withIntermediateDirectories:YES
attributes:nil
error:&error]) {

if (error) {
SIMBLLogNotice(@"createDirectoryAtPath error:%@",error);
return;
}
SIMBLLogNotice(@"createDirectoryAtPath error:%@",error);
return;
}
} else if (!isDirectory) {
SIMBLLogNotice(@"%@ is file. Expect are directory", self.scriptingAdditionsPath);
Expand All @@ -183,13 +179,35 @@ - (void) injectSIMBL:(NSRunningApplication *)runningApp
return;
}

// hardlink SIMBL.osax to ScriptingAdditions
if (![fileManager fileExistsAtPath:self.linkedOsaxPath isDirectory:&isDirectory]) {
[fileManager linkItemAtPath:self.osaxPath toPath:self.linkedOsaxPath error:&error];
// create SIMBL.osax to ScriptingAdditions
if (!self.waitingInjectionNumber) {
[fileManager removeItemAtPath:self.linkedOsaxPath error:nil];

// check fileSystems
id fsOflinkedOsax = [[fileManager attributesOfItemAtPath:self.scriptingAdditionsPath error:&error] objectForKey:NSFileSystemNumber];
if (error) {
SIMBLLogNotice(@"linkItemAtPath error:%@",error);
SIMBLLogNotice(@"attributesOfItemAtPath error:%@",error);
return;
}
id fsOfOsax = [[fileManager attributesOfItemAtPath:self.osaxPath error:&error] objectForKey:NSFileSystemNumber];
if (error) {
SIMBLLogNotice(@"attributesOfItemAtPath error:%@",error);
return;
}

if ([fsOflinkedOsax isEqual:fsOfOsax]) {
// create hard link
if (![fileManager linkItemAtPath:self.osaxPath toPath:self.linkedOsaxPath error:&error]) {
SIMBLLogNotice(@"linkItemAtPath error:%@",error);
return;
}
} else {
// create copy
if (![fileManager copyItemAtPath:self.osaxPath toPath:self.linkedOsaxPath error:&error]) {
SIMBLLogNotice(@"copyItemAtPath error:%@",error);
return;
}
}
}
self.waitingInjectionNumber++;

Expand Down Expand Up @@ -277,30 +295,24 @@ - (BOOL)injectContainerBundleIdentifier:(NSString*)bundleIdentifier enabled:(BOO
NSString *containerApplicationSupportPath = [NSString pathWithComponents:[NSArray arrayWithObjects:containerPath, dataLibraryPath, EasySIMBLApplicationSupportPathComponent, nil]];
NSString *containerPlistPath = [NSString pathWithComponents:[NSArray arrayWithObjects:containerPath, dataLibraryPath,EasySIMBLPreferencesPathComponent, [EasySIMBLSuiteBundleIdentifier stringByAppendingPathExtension:EasySIMBLPreferencesExtension], nil]];
if (bEnabled) {
[fileManager linkItemAtPath:self.scriptingAdditionsPath toPath:containerScriptingAddtionsPath error:&error];
if (error) {
if (![fileManager linkItemAtPath:self.scriptingAdditionsPath toPath:containerScriptingAddtionsPath error:&error]) {
SIMBLLogNotice(@"linkItemAtPath error:%@",error);
}
[fileManager linkItemAtPath:self.applicationSupportPath toPath:containerApplicationSupportPath error:&error];
if (error) {
if (![fileManager linkItemAtPath:self.applicationSupportPath toPath:containerApplicationSupportPath error:&error]) {
SIMBLLogNotice(@"linkItemAtPath error:%@",error);
}
[fileManager linkItemAtPath:self.plistPath toPath:containerPlistPath error:&error];
if (error) {
if (![fileManager linkItemAtPath:self.plistPath toPath:containerPlistPath error:&error]) {
SIMBLLogNotice(@"linkItemAtPath error:%@",error);
}
bResult = YES;
} else {
[fileManager removeItemAtPath:containerScriptingAddtionsPath error:&error];
if (error) {
if (![fileManager removeItemAtPath:containerScriptingAddtionsPath error:&error]) {
SIMBLLogNotice(@"removeItemAtPath error:%@",error);
}
[fileManager removeItemAtPath:containerApplicationSupportPath error:&error];
if (error) {
if (![fileManager removeItemAtPath:containerApplicationSupportPath error:&error]) {
SIMBLLogNotice(@"removeItemAtPath error:%@",error);
}
[fileManager removeItemAtPath:containerPlistPath error:&error];
if (error) {
if (![fileManager removeItemAtPath:containerPlistPath error:&error]) {
SIMBLLogNotice(@"removeItemAtPath error:%@",error);
}
bResult = YES;
Expand Down
4 changes: 2 additions & 2 deletions SIMBL.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_VERSION = 0.10.4;
PRODUCT_VERSION = 0.10.5;
SDKROOT = macosx;
};
name = Debug;
Expand All @@ -389,7 +389,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_VERSION = 0.10.4;
PRODUCT_VERSION = 0.10.5;
SDKROOT = macosx;
};
name = Release;
Expand Down

0 comments on commit 3f937f0

Please sign in to comment.