summaryrefslogtreecommitdiff
path: root/macosx/PcsxrPlugin.m
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-01-10 01:02:14 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-01-10 01:02:14 +0000
commitf9cb1c85ed195c205d7bb48b69c83a7838cb9aa2 (patch)
tree0bc1e43f33158709d33c43b061f96145a98ad685 /macosx/PcsxrPlugin.m
parent564758db27f02a09c61a1ac068a2fa22c887a0dd (diff)
downloadpcsxr-f9cb1c85ed195c205d7bb48b69c83a7838cb9aa2.tar.gz
Messing with the OS X plug-in code:
Making it so that absolute paths are properly handled on plug-ins. Put the absolute path if we load a plug-in from somewhere else than the App's built-in location. Have path in PcsxrPlugin be an Objective C property. Also making the name a new Objective C property. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@82165 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/PcsxrPlugin.m')
-rwxr-xr-xmacosx/PcsxrPlugin.m50
1 files changed, 29 insertions, 21 deletions
diff --git a/macosx/PcsxrPlugin.m b/macosx/PcsxrPlugin.m
index b7ecd5d6..97e3fbc6 100755
--- a/macosx/PcsxrPlugin.m
+++ b/macosx/PcsxrPlugin.m
@@ -93,6 +93,9 @@
return returnArray;
}
+@synthesize path;
+@synthesize name;
+
- (id)initWithPath:(NSString *)aPath
{
if (!(self = [super init])) {
@@ -103,28 +106,38 @@
PSEgetLibVersion PSE_getLibVersion = NULL;
PSEgetLibName PSE_getLibName = NULL;
+ NSFileManager *fm = [NSFileManager defaultManager];
+
pluginRef = nil;
name = nil;
path = [aPath copy];
- long tempVers = 0;
NSString *goodPath = nil;
- for (NSString *plugDir in [PcsxrPlugin pluginsPaths])
- {
- NSString *fullPath = [plugDir stringByAppendingPathComponent:path];
- if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]) {
- void *tempHandle = SysLoadLibrary([fullPath fileSystemRepresentation]);
- if (tempHandle != NULL)
- {
- PSEgetLibVersion tempLibVersion = SysLoadSym(tempHandle, "PSEgetLibVersion");
- if (SysLibError() == NULL)
+ if ([aPath isAbsolutePath]) {
+ goodPath = aPath;
+ } else {
+ long tempVers = 0;
+ for (NSString *plugDir in [PcsxrPlugin pluginsPaths])
+ {
+ NSString *fullPath = [plugDir stringByAppendingPathComponent:path];
+ if ([fm fileExistsAtPath:fullPath]) {
+ void *tempHandle = SysLoadLibrary([fullPath fileSystemRepresentation]);
+ if (tempHandle != NULL)
{
- long tempVers2 = tempLibVersion();
- if (tempVers <= tempVers2 ){
- goodPath = fullPath;
- tempVers = tempVers2;
+ PSEgetLibVersion tempLibVersion = SysLoadSym(tempHandle, "PSEgetLibVersion");
+ if (SysLibError() == NULL)
+ {
+ long tempVers2 = tempLibVersion();
+ if (tempVers <= tempVers2 ){
+ goodPath = fullPath;
+ tempVers = tempVers2;
+ if (![plugDir isEqualToString:[fm stringWithFileSystemRepresentation:Config.PluginsDir length:strlen(Config.PluginsDir)]]) {
+ RELEASEOBJ(path);
+ path = [goodPath copy];
+ }
+ }
}
+ SysCloseLibrary(tempHandle);
}
- SysCloseLibrary(tempHandle);
}
}
}
@@ -135,7 +148,7 @@
}
pluginRef = SysLoadLibrary([goodPath fileSystemRepresentation]);
- if (pluginRef == nil) {
+ if (pluginRef == NULL) {
RELEASEOBJ(self);
return nil;
}
@@ -336,11 +349,6 @@
return type;
}
-- (NSString *)path
-{
- return path;
-}
-
- (NSUInteger)hash
{
return [path hash];