[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-dev] [patch] Changes to stand-alone application
Joshua Parmenter asked me to make the stand-alone version of SC not
look in extensions folders, but only inside the bundle. I thought
that seemed like a good idea, since someone might have both SC and an
SC stand-alone application on the same machine.
I was uncomfortable with the amount of code in #ifdefs, so I broke
the Mac-specific stuff out into a separate class and file (which
explains the length of this patch). This will break the old projects,
so I would need someone to add the new files to them.
It shouldn't affect Linux or Windows at all, but I certainly wouldn't
mind if someone wanted to double-check that.
The patch:
Index: headers/common/SC_DirUtils.h
===================================================================
RCS file: /cvsroot/supercollider/SuperCollider3/headers/common/
SC_DirUtils.h,v
retrieving revision 1.7
diff -u -p -r1.7 SC_DirUtils.h
--- headers/common/SC_DirUtils.h 12 Dec 2005 19:44:48 -0000 1.7
+++ headers/common/SC_DirUtils.h 6 Jan 2006 06:41:54 -0000
@@ -60,7 +60,7 @@ void sc_ResolveIfAlias(const char *path,
void sc_GetResourceDirectory(char* pathBuf, int length);
void sc_GetResourceDirectoryFromAppDirectory(char* pathBuf, int length);
-
+bool sc_IsStandAlone();
// Support for Extensions
Index: source/app/MyDocument.M
===================================================================
RCS file: /cvsroot/supercollider/SuperCollider3/source/app/
MyDocument.M,v
retrieving revision 1.51
diff -u -p -r1.51 MyDocument.M
--- source/app/MyDocument.M 6 Nov 2005 22:08:05 -0000 1.51
+++ source/app/MyDocument.M 6 Jan 2006 06:41:54 -0000
@@ -602,31 +602,32 @@ NSString* helpFileWithName(NSFileManager
// If called with no folder check in the bundle (if OS X), SC
distribution Help
// directory, and the System and User Extensions directories.
if(!helpFolderPath) {
- NSString* helpFilePath ;
- NSString* searchPath ;
-
- char resourceDirPath[MAXPATHLEN - 32];
- sc_GetResourceDirectory(resourceDirPath, MAXPATHLEN - 32);
- sc_AppendToPath(resourceDirPath, "Help/");
- searchPath = [NSString stringWithCString:(const char *)
resourceDirPath];
- helpFilePath = helpFileWithName(fileManager, desiredHelpFile,
extension, searchPath);
- if (helpFilePath) return helpFilePath;
-
- searchPath = [NSString stringWithFormat: @"%@/Help/",
- [fileManager currentDirectoryPath]];
- helpFilePath = helpFileWithName(fileManager, desiredHelpFile,
extension, searchPath);
- if (helpFilePath) return helpFilePath;
-
- searchPath = @"/Library/Application Support/SuperCollider/
Extensions/";
- helpFilePath = helpFileWithName(fileManager, desiredHelpFile,
extension, searchPath);
- if (helpFilePath) return helpFilePath;
-
- searchPath = [NSString stringWithFormat: @"%@/Library/
Application Support/SuperCollider/Extensions/",
- NSHomeDirectory()];
- helpFilePath = helpFileWithName(fileManager, desiredHelpFile,
extension, searchPath);
- if (helpFilePath) return helpFilePath;
-
- return NULL;
+ NSString* helpFilePath ;
+ NSString* searchPath ;
+
+ char resourceDirPath[MAXPATHLEN - 32];
+ sc_GetResourceDirectory(resourceDirPath, MAXPATHLEN - 32);
+ sc_AppendToPath(resourceDirPath, "Help/");
+ searchPath = [NSString stringWithCString:(const char *)
resourceDirPath];
+ helpFilePath = helpFileWithName(fileManager,
desiredHelpFile, extension, searchPath);
+ if (helpFilePath) return helpFilePath;
+
+ if(!sc_IsStandAlone()) {
+ searchPath = [NSString stringWithFormat: @"%@/Help/",
+ [fileManager currentDirectoryPath]];
+ helpFilePath = helpFileWithName(fileManager,
desiredHelpFile, extension, searchPath);
+ if (helpFilePath) return helpFilePath;
+
+ searchPath = @"/Library/Application Support/
SuperCollider/Extensions/";
+ helpFilePath = helpFileWithName(fileManager,
desiredHelpFile, extension, searchPath);
+ if (helpFilePath) return helpFilePath;
+
+ searchPath = [NSString stringWithFormat: @"%@/Library/
Application Support/SuperCollider/Extensions/",
+ NSHomeDirectory()];
+ helpFilePath = helpFileWithName(fileManager,
desiredHelpFile, extension, searchPath);
+ if (helpFilePath) return helpFilePath;
+ }
+ return NULL;
}
// the name of the help file we are looking for
Index: source/common/SC_DirUtils.cpp
===================================================================
RCS file: /cvsroot/supercollider/SuperCollider3/source/common/
SC_DirUtils.cpp,v
retrieving revision 1.8
diff -u -p -r1.8 SC_DirUtils.cpp
--- source/common/SC_DirUtils.cpp 12 Dec 2005 19:49:50 -0000 1.8
+++ source/common/SC_DirUtils.cpp 6 Jan 2006 06:41:55 -0000
@@ -33,16 +33,18 @@
# include <sys/types.h>
#endif
+#include <stdexcept>
+#include "SC_DirUtils.h"
+
#ifdef SC_DARWIN
+#ifndef _SC_StandAloneInfo_
+# include "SC_StandAloneInfo_Darwin.h"
+#endif
# include <CoreFoundation/CFString.h>
# include <CoreFoundation/CFBundle.h>
# include <CoreServices/CoreServices.h>
-//# include <CoreServices/Aliases.h>
#endif
-#include <stdexcept>
-#include "SC_DirUtils.h"
-
// Add a component to a path.
void sc_AppendToPath(char *path, const char *component)
@@ -158,7 +160,6 @@ void sc_ResolveIfAlias(const char *path,
osStatusErr = FSRefMakePath (&dirRef, resolvedPath,
length);
if ( !osStatusErr ) {
strncpy(returnPath, (char *) resolvedPath, length);
-// resolvedPath[length] = 0;
return;
}
}
@@ -176,6 +177,11 @@ void sc_ResolveIfAlias(const char *path,
#ifndef SC_DARWIN
+bool sc_IsStandAlone()
+{
+ return false;
+}
+
void sc_GetResourceDirectory(char* pathBuf, int length)
{
sc_GetResourceDirectoryFromAppDirectory(pathBuf, length);
@@ -183,70 +189,18 @@ void sc_GetResourceDirectory(char* pathB
#else // running on OS X
+// Support for stand-alone applications
+
+bool sc_IsStandAlone()
+{
+ return SC_StandAloneInfo::IsStandAlone();
+}
+
void sc_GetResourceDirectory(char* pathBuf, int length)
{
- static bool haveCheckedBundleStatus = false;
- static char dirPath[PATH_MAX];
-
- CFStringEncoding encoding = kCFStringEncodingASCII;
-
- if ( !haveCheckedBundleStatus )
- {
- haveCheckedBundleStatus = true;
-
- // If scsynth is in the bundle, we'll use that, and set our
home
- // path to the bundle's Resources directory.
-
- CFStringRef stringToFind = CFSTR("SCClassLibrary");
- CFURLRef enablerURL = CFBundleCopyResourceURL (
- CFBundleGetMainBundle(),
- stringToFind,
- NULL,
- NULL
- );
-
- if ( enablerURL )
- {
- // You'd think we could get an absolute path to the
Resources directory. But
- // we can't, we can only get a relative path, or an
absolute path to a
- // specific resource. Since we don't know the
application name, we get the
- // latter, and then hack off the resource name.
-
- CFStringRef rawPath = CFURLCopyFileSystemPath
(enablerURL, kCFURLPOSIXPathStyle);
-
- CFRange discardRange = CFStringFind (
- CFURLCopyFileSystemPath(enablerURL,
kCFURLPOSIXPathStyle),
- stringToFind,
- 0
- );
-
- CFRange validRange;
- validRange.location = 0;
- validRange.length = discardRange.location - 1;
-
- CFStringRef dirPathCFString = CFStringCreateWithSubstring (
- kCFAllocatorDefault,
- rawPath,
- validRange
- );
-
- CFStringGetCString (
- dirPathCFString,
- dirPath,
- PATH_MAX,
- encoding
- );
- }
-
- else
- {
- sc_GetResourceDirectoryFromAppDirectory(dirPath, length);
- };
- }
-
- // Copy the static variable to the caller's buffer.
- strncpy(pathBuf, dirPath, length);
+ SC_StandAloneInfo::GetResourceDir(pathBuf, length);
}
+
#endif // ifndef SC_DARWIN
void sc_GetResourceDirectoryFromAppDirectory(char* pathBuf, int length)
@@ -254,6 +208,7 @@ void sc_GetResourceDirectoryFromAppDirec
getcwd(pathBuf, length);
}
+
// Support for Extensions
// Get the user home directory.
Index: source/lang/LangSource/PyrLexer.cpp
===================================================================
RCS file: /cvsroot/supercollider/SuperCollider3/source/lang/
LangSource/PyrLexer.cpp,v
retrieving revision 1.59
diff -u -p -r1.59 PyrLexer.cpp
--- source/lang/LangSource/PyrLexer.cpp 16 Nov 2005 13:18:43
-0000 1.59
+++ source/lang/LangSource/PyrLexer.cpp 6 Jan 2006 06:41:55 -0000
@@ -1997,8 +1997,10 @@ static void sc_InitCompileDirectories(vo
}
#endif
- sc_GetSystemExtensionDirectory(gSystemExtensionDir, MAXPATHLEN);
- sc_GetUserExtensionDirectory(gUserExtensionDir, MAXPATHLEN);
+ if (!sc_IsStandAlone()) {
+ sc_GetSystemExtensionDirectory(gSystemExtensionDir,
MAXPATHLEN);
+ sc_GetUserExtensionDirectory(gUserExtensionDir, MAXPATHLEN);
+ }
}
bool passOne()
@@ -2015,14 +2017,16 @@ bool passOne()
success = passOne_ProcessDir(gCompileDir, 0);
if (!success) return false;
- if(sc_DirectoryExists(gSystemExtensionDir)) {
- success = passOne_ProcessDir(gSystemExtensionDir,0);
- if (!success) return false;
- }
+ if (!sc_IsStandAlone()) {
+ if(sc_DirectoryExists(gSystemExtensionDir)) {
+ success = passOne_ProcessDir(gSystemExtensionDir,0);
+ if (!success) return false;
+ }
- if(sc_DirectoryExists(gUserExtensionDir)) {
- success = passOne_ProcessDir(gUserExtensionDir,0);
- if (!success) return false;
+ if(sc_DirectoryExists(gUserExtensionDir)) {
+ success = passOne_ProcessDir(gUserExtensionDir,0);
+ if (!success) return false;
+ }
}
} else {
#ifdef ENABLE_LIBRARY_CONFIGURATOR
Index: xSC3lang.xcodeproj/project.pbxproj
===================================================================
RCS file: /cvsroot/supercollider/SuperCollider3/xSC3lang.xcodeproj/
project.pbxproj,v
retrieving revision 1.3
diff -u -p -r1.3 project.pbxproj
--- xSC3lang.xcodeproj/project.pbxproj 1 Nov 2005 05:45:03
-0000 1.3
+++ xSC3lang.xcodeproj/project.pbxproj 6 Jan 2006 06:41:56 -0000
@@ -254,6 +254,12 @@
88D7D584090C8737008D45B9 /* SC_DirUtils.h in Headers */ =
{isa = PBXBuildFile; fileRef = 88D7D583090C8737008D45B9 /*
SC_DirUtils.h */; };
88D7D585090C8737008D45B9 /* SC_DirUtils.h in Headers */ =
{isa = PBXBuildFile; fileRef = 88D7D583090C8737008D45B9 /*
SC_DirUtils.h */; };
88D7D586090C8737008D45B9 /* SC_DirUtils.h in Headers */ =
{isa = PBXBuildFile; fileRef = 88D7D583090C8737008D45B9 /*
SC_DirUtils.h */; };
+ 88FB09A8096DC6F20012327A /* SC_StandAloneInfo_Darwin.h in
Headers */ = {isa = PBXBuildFile; fileRef = 88FB09A7096DC6F20012327A /
* SC_StandAloneInfo_Darwin.h */; };
+ 88FB09A9096DC6F20012327A /* SC_StandAloneInfo_Darwin.h in
Headers */ = {isa = PBXBuildFile; fileRef = 88FB09A7096DC6F20012327A /
* SC_StandAloneInfo_Darwin.h */; };
+ 88FB09AA096DC6F20012327A /* SC_StandAloneInfo_Darwin.h in
Headers */ = {isa = PBXBuildFile; fileRef = 88FB09A7096DC6F20012327A /
* SC_StandAloneInfo_Darwin.h */; };
+ 88FB09AC096DC7040012327A /* SC_StandAloneInfo_Darwin.cpp in
Sources */ = {isa = PBXBuildFile; fileRef = 88FB09AB096DC7040012327A /
* SC_StandAloneInfo_Darwin.cpp */; };
+ 88FB09AD096DC7040012327A /* SC_StandAloneInfo_Darwin.cpp in
Sources */ = {isa = PBXBuildFile; fileRef = 88FB09AB096DC7040012327A /
* SC_StandAloneInfo_Darwin.cpp */; };
+ 88FB09AE096DC7040012327A /* SC_StandAloneInfo_Darwin.cpp in
Sources */ = {isa = PBXBuildFile; fileRef = 88FB09AB096DC7040012327A /
* SC_StandAloneInfo_Darwin.cpp */; };
908DBC370507C63D00000098 /* GoToPanel.M in Sources */ =
{isa = PBXBuildFile; fileRef = 908DBC360507C63D00000098 /*
GoToPanel.M */; };
908DBC390507C65100000098 /* GoToPanel.h in Headers */ =
{isa = PBXBuildFile; fileRef = 908DBC380507C65100000098 /*
GoToPanel.h */; };
908DBC3B0507C66500000098 /* GoToLinePanel.nib in Resources
*/ = {isa = PBXBuildFile; fileRef = 908DBC3A0507C66500000098 /*
GoToLinePanel.nib */; };
@@ -799,6 +805,8 @@
6AC9B2DA08ABF480001EBDF6 /* QuickTime.framework */ = {isa =
PBXFileReference; lastKnownFileType = wrapper.framework; name =
QuickTime.framework; path = /System/Library/Frameworks/
QuickTime.framework; sourceTree = "<absolute>"; };
88723044090870B30002E26A /* English */ = {isa =
PBXFileReference; fileEncoding = 30; lastKnownFileType =
text.plist.strings; name = English; path = English.lproj/
InfoPlist.strings; sourceTree = "<group>"; };
88D7D583090C8737008D45B9 /* SC_DirUtils.h */ = {isa =
PBXFileReference; fileEncoding = 30; lastKnownFileType =
sourcecode.c.h; path = SC_DirUtils.h; sourceTree = "<group>"; };
+ 88FB09A7096DC6F20012327A /* SC_StandAloneInfo_Darwin.h */ =
{isa = PBXFileReference; fileEncoding = 30; lastKnownFileType =
sourcecode.c.h; path = SC_StandAloneInfo_Darwin.h; sourceTree =
"<group>"; };
+ 88FB09AB096DC7040012327A /* SC_StandAloneInfo_Darwin.cpp */
= {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType =
sourcecode.cpp.cpp; path = SC_StandAloneInfo_Darwin.cpp; sourceTree =
"<group>"; };
908DBC360507C63D00000098 /* GoToPanel.M */ = {isa =
PBXFileReference; fileEncoding = "-2147483619"; lastKnownFileType =
sourcecode.cpp.objcpp; path = GoToPanel.M; sourceTree = "<group>"; };
908DBC380507C65100000098 /* GoToPanel.h */ = {isa =
PBXFileReference; fileEncoding = "-2147483619"; lastKnownFileType =
sourcecode.c.h; path = GoToPanel.h; sourceTree = "<group>"; };
908DBC3A0507C66500000098 /* GoToLinePanel.nib */ = {isa =
PBXFileReference; lastKnownFileType = wrapper.nib; name =
GoToLinePanel.nib; path = resources/GoToLinePanel.nib; sourceTree =
"<group>"; };
@@ -1125,6 +1133,7 @@
F50D050A02E69B6B01CA2799 /* common */ = {
isa = PBXGroup;
children = (
+ 88FB09A7096DC6F20012327A /*
SC_StandAloneInfo_Darwin.h */,
88D7D583090C8737008D45B9 /* SC_DirUtils.h */,
F5C7B150033D5B4801A80099 /* SC_World.h */,
F5C7B154033D5EDC01A80099 /* SC_WorldOptions.h */,
@@ -1265,6 +1274,7 @@
F50D059202E69B6B01CA2799 /* common */ = {
isa = PBXGroup;
children = (
+ 88FB09AB096DC7040012327A /*
SC_StandAloneInfo_Darwin.cpp */,
B22686280916E0B500FEBB03 /* SC_DirUtils.cpp */,
6AAC6D6408FEDC0C006134E1 /* fftlib.c */,
F59DF065030733E801CE0C16 /* dlopen.c */,
@@ -1503,6 +1513,7 @@
92B5F3A20547488200496808 /*
HID_Utilities_Internal.h in Headers */,
9286AEA5057D30EC000EBAEB /* SCService.h in Headers */,
88D7D585090C8737008D45B9 /* SC_DirUtils.h in
Headers */,
+ 88FB09A9096DC6F20012327A /*
SC_StandAloneInfo_Darwin.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1610,6 +1621,7 @@
6A7207DD07BB70CB00A1F778 /* SCCocoaView.h in
Headers */,
6A40715507C7240E003E9C23 /* SCSoundFileView.h in
Headers */,
88D7D584090C8737008D45B9 /* SC_DirUtils.h in
Headers */,
+ 88FB09A8096DC6F20012327A /*
SC_StandAloneInfo_Darwin.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1689,6 +1701,7 @@
92B4EA56059397C600CA25E4 /* SC_LibraryConfig.h in
Headers */,
92B4EA62059399DD00CA25E4 /* SC_StringBuffer.h in
Headers */,
88D7D586090C8737008D45B9 /* SC_DirUtils.h in
Headers */,
+ 88FB09AA096DC6F20012327A /*
SC_StandAloneInfo_Darwin.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1888,6 +1901,7 @@
92B5F3EE0547488200496808 /* HID_Utilities.c in
Sources */,
92B5F3EF0547488200496808 /* SC_HID.cpp in Sources */,
9286AEA0057D30B9000EBAEB /* SCService.mm in Sources
*/,
+ 88FB09AD096DC7040012327A /*
SC_StandAloneInfo_Darwin.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1975,6 +1989,7 @@
6A40718607C72B26003E9C23 /* SCSoundFileView.M in
Sources */,
6AAC6D6508FEDC0C006134E1 /* fftlib.c in Sources */,
B22686290916E0B500FEBB03 /* SC_DirUtils.cpp in
Sources */,
+ 88FB09AC096DC7040012327A /*
SC_StandAloneInfo_Darwin.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2036,6 +2051,7 @@
92FC9EFB06EB774900AA3E95 /* g_fmt.c in Sources */,
6AAC6D6608FEDC0C006134E1 /* fftlib.c in Sources */,
88C3944A09172B6900B740D4 /* SC_DirUtils.cpp in
Sources */,
+ 88FB09AE096DC7040012327A /*
SC_StandAloneInfo_Darwin.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Index: xSC_StandAlone.xcodeproj/project.pbxproj
===================================================================
RCS file: /cvsroot/supercollider/SuperCollider3/
xSC_StandAlone.xcodeproj/project.pbxproj,v
retrieving revision 1.5
diff -u -p -r1.5 project.pbxproj
--- xSC_StandAlone.xcodeproj/project.pbxproj 8 Nov 2005 07:50:01
-0000 1.5
+++ xSC_StandAlone.xcodeproj/project.pbxproj 6 Jan 2006 06:41:56
-0000
@@ -197,7 +197,7 @@
88DB9527090A0E3700BE5BE9 /* Sources */,
88DB9578090A0E3700BE5BE9 /* Frameworks */,
88DB9583090A0E3700BE5BE9 /* Rez */,
- 88931C5B090A1D0900DA33D4 /* ShellScript */,
+ 88FB09E4096E388F0012327A /* ShellScript */,
);
buildSettings = {
FRAMEWORK_SEARCH_PATHS = "\"$(SYSTEM_LIBRARY_DIR)/
Frameworks/CoreServices.framework/Versions/A/Frameworks\"";
@@ -783,6 +783,10 @@
88DB9580090A0E3700BE5BE9 /* libsndfile.a in Frameworks */ =
{isa = PBXBuildFile; fileRef = F50D06C002E7F29001CA2799 /*
libsndfile.a */; };
88DB9581090A0E3700BE5BE9 /* QuickTime.framework in
Frameworks */ = {isa = PBXBuildFile; fileRef =
6AC9B2DA08ABF480001EBDF6 /* QuickTime.framework */; };
88DB9582090A0E3700BE5BE9 /* libscsynth.a in Frameworks */ =
{isa = PBXBuildFile; fileRef = 88DB9483090A077F00BE5BE9 /*
libscsynth.a */; };
+ 88FB089A096CFA4E0012327A /* SC_StandAloneInfo_Darwin.cpp in
Sources */ = {isa = PBXBuildFile; fileRef = 88FB0899096CFA4E0012327A /
* SC_StandAloneInfo_Darwin.cpp */; };
+ 88FB089B096CFA4E0012327A /* SC_StandAloneInfo_Darwin.cpp in
Sources */ = {isa = PBXBuildFile; fileRef = 88FB0899096CFA4E0012327A /
* SC_StandAloneInfo_Darwin.cpp */; };
+ 88FB08AC096CFC290012327A /* SC_StandAloneInfo_Darwin.h in
Headers */ = {isa = PBXBuildFile; fileRef = 88FB08AB096CFC290012327A /
* SC_StandAloneInfo_Darwin.h */; };
+ 88FB08AD096CFC290012327A /* SC_StandAloneInfo_Darwin.h in
Headers */ = {isa = PBXBuildFile; fileRef = 88FB08AB096CFC290012327A /
* SC_StandAloneInfo_Darwin.h */; };
B2268BA50916E3A200FEBB03 /* SC_DirUtils.cpp in Sources */ =
{isa = PBXBuildFile; fileRef = B2268BA40916E3A200FEBB03 /*
SC_DirUtils.cpp */; };
B2268BA60916E3A200FEBB03 /* SC_DirUtils.cpp in Sources */ =
{isa = PBXBuildFile; fileRef = B2268BA40916E3A200FEBB03 /*
SC_DirUtils.cpp */; };
/* End PBXBuildFile section */
@@ -878,6 +882,8 @@
88D7CA41090C69C5008D45B9 /* SC_DirUtils.h */ = {isa =
PBXFileReference; fileEncoding = 30; lastKnownFileType =
sourcecode.c.h; path = SC_DirUtils.h; sourceTree = "<group>"; };
88DB9483090A077F00BE5BE9 /* libscsynth.a */ = {isa =
PBXFileReference; lastKnownFileType = archive.ar; name =
libscsynth.a; path = build/libscsynth.a; sourceTree = "<group>"; };
88DB958A090A0E3700BE5BE9 /* SC_StandAlone_Devel.app */ =
{isa = PBXFileReference; explicitFileType = wrapper.application;
includeInIndex = 0; path = SC_StandAlone_Devel.app; sourceTree =
BUILT_PRODUCTS_DIR; };
+ 88FB0899096CFA4E0012327A /* SC_StandAloneInfo_Darwin.cpp */
= {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.cpp.cpp; path = SC_StandAloneInfo_Darwin.cpp; sourceTree =
"<group>"; };
+ 88FB08AB096CFC290012327A /* SC_StandAloneInfo_Darwin.h */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.c.h; path = SC_StandAloneInfo_Darwin.h; sourceTree =
"<group>"; };
908DBC360507C63D00000098 /* GoToPanel.M */ = {isa =
PBXFileReference; fileEncoding = "-2147483619"; lastKnownFileType =
sourcecode.cpp.objcpp; path = GoToPanel.M; sourceTree = "<group>"; };
908DBC380507C65100000098 /* GoToPanel.h */ = {isa =
PBXFileReference; fileEncoding = "-2147483619"; lastKnownFileType =
sourcecode.c.h; path = GoToPanel.h; sourceTree = "<group>"; };
90A4CDA0044D5AF2000000AF /* SC_Speech.cpp */ = {isa =
PBXFileReference; fileEncoding = 30; lastKnownFileType =
sourcecode.cpp.cpp; name = SC_Speech.cpp; path = source/lang/
LangSource/SC_Speech.cpp; sourceTree = SOURCE_ROOT; };
@@ -1202,6 +1208,7 @@
F50D050A02E69B6B01CA2799 /* common */ = {
isa = PBXGroup;
children = (
+ 88FB08AB096CFC290012327A /*
SC_StandAloneInfo_Darwin.h */,
88D7CA41090C69C5008D45B9 /* SC_DirUtils.h */,
F5C7B150033D5B4801A80099 /* SC_World.h */,
F5C7B154033D5EDC01A80099 /* SC_WorldOptions.h */,
@@ -1342,6 +1349,7 @@
F50D059202E69B6B01CA2799 /* common */ = {
isa = PBXGroup;
children = (
+ 88FB0899096CFA4E0012327A /*
SC_StandAloneInfo_Darwin.cpp */,
B2268BA40916E3A200FEBB03 /* SC_DirUtils.cpp */,
6AAC6D6408FEDC0C006134E1 /* fftlib.c */,
F59DF065030733E801CE0C16 /* dlopen.c */,
@@ -1585,6 +1593,7 @@
8858D77F090864A5006F2C14 /* SCCocoaView.h in
Headers */,
8858D780090864A5006F2C14 /* SCSoundFileView.h in
Headers */,
88D7CA43090C69C5008D45B9 /* SC_DirUtils.h in
Headers */,
+ 88FB08AC096CFC290012327A /*
SC_StandAloneInfo_Darwin.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1692,6 +1701,7 @@
88DB9511090A0E3700BE5BE9 /* SCCocoaView.h in
Headers */,
88DB9512090A0E3700BE5BE9 /* SCSoundFileView.h in
Headers */,
88D7CA42090C69C5008D45B9 /* SC_DirUtils.h in
Headers */,
+ 88FB08AD096CFC290012327A /*
SC_StandAloneInfo_Darwin.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1786,7 +1796,7 @@
/* End PBXRezBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
- 88931C5B090A1D0900DA33D4 /* ShellScript */ = {
+ 88D7D546090C6C50008D45B9 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -1797,9 +1807,9 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "ln -s \"`pwd`/SCSA_Aux/SCSA_Library\"
\"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources/
SCClassLibrary/SCSA_Library_alias\"";
+ shellScript = "cp SCSA_Aux/SCSA_Main_Replacement/Main.sc
\"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources/
SCClassLibrary/DefaultLibrary\"\ncp -R SCSA_Aux/SCSA_Help
\"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources/Help\"\n[ -e
\"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources/sounds\" ]
|| mkdir \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources/
sounds\"";
};
- 88D7D546090C6C50008D45B9 /* ShellScript */ = {
+ 88FB09E4096E388F0012327A /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -1810,7 +1820,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "cp SCSA_Aux/SCSA_Main_Replacement/Main.sc
\"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources/
SCClassLibrary/DefaultLibrary\"\ncp -R SCSA_Aux/SCSA_Help
\"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources/Help\"\n[ -e
\"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources/sounds\" ]
|| mkdir \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources/
sounds\"";
+ shellScript = "[ -e \"$TARGET_BUILD_DIR/
$PRODUCT_NAME.app/Contents/Resources/SCClassLibrary/SCSA_Library_alias
\" ] || ln -s \"`pwd`/SCSA_Aux/SCSA_Library\" \"$TARGET_BUILD_DIR/
$PRODUCT_NAME.app/Contents/Resources/SCClassLibrary/SCSA_Library_alias
\"";
};
/* End PBXShellScriptBuildPhase section */
@@ -1899,6 +1909,7 @@
8858D7DB090864A5006F2C14 /* SCSoundFileView.M in
Sources */,
8858D7DC090864A5006F2C14 /* fftlib.c in Sources */,
B2268BA50916E3A200FEBB03 /* SC_DirUtils.cpp in
Sources */,
+ 88FB089A096CFA4E0012327A /*
SC_StandAloneInfo_Darwin.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1986,6 +1997,7 @@
88DB9575090A0E3700BE5BE9 /* SCSoundFileView.M in
Sources */,
88DB9576090A0E3700BE5BE9 /* fftlib.c in Sources */,
B2268BA60916E3A200FEBB03 /* SC_DirUtils.cpp in
Sources */,
+ 88FB089B096CFA4E0012327A /*
SC_StandAloneInfo_Darwin.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2200,7 +2212,7 @@
);
OTHER_LDFLAGS = /usr/local/lib/libsndfile.a;
OTHER_REZFLAGS = "";
- PRODUCT_NAME = SC_StandAlone;
+ PRODUCT_NAME = SC_StandAlone_Devel;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = (
"-Wmost",
--- /dev/null 2006-01-05 22:40:29.000000000 -0800
+++ ./source/common/SC_StandAloneInfo_Darwin.cpp 2006-01-05
00:43:57.000000000 -0800
@@ -0,0 +1,87 @@
+#ifdef SC_DARWIN
+
+#include <sys/param.h>
+#include <stdexcept>
+
+#include <CoreFoundation/CFString.h>
+#include <CoreFoundation/CFBundle.h>
+#include <CoreServices/CoreServices.h>
+
+#include "SC_StandAloneInfo_Darwin.h"
+
+bool SC_StandAloneInfo::sIsStandAlone;
+bool SC_StandAloneInfo::haveCheckedBundleStatus;
+char SC_StandAloneInfo::dirPath[PATH_MAX];
+
+void SC_StandAloneInfo::SC_StandAloneInfoInit() {
+ CFStringEncoding encoding = kCFStringEncodingASCII;
+
+ if ( !haveCheckedBundleStatus )
+ {
+ haveCheckedBundleStatus = true;
+ CFStringRef stringToFind = CFSTR("SCClassLibrary");
+ CFURLRef enablerURL = CFBundleCopyResourceURL (
+ CFBundleGetMainBundle(),
+ stringToFind,
+ NULL,
+ NULL
+ );
+ if ( enablerURL )
+ {
+ // You'd think we could get an absolute path to the
Resources directory. But
+ // we can't, we can only get a relative path, or an
absolute path to a
+ // specific resource. Since we don't know the
application name, we get the
+ // latter, and then hack off the resource name.
+
+ sIsStandAlone = true;
+ CFStringRef rawPath = CFURLCopyFileSystemPath
(enablerURL, kCFURLPOSIXPathStyle);
+
+ CFRange discardRange = CFStringFind (
+ CFURLCopyFileSystemPath(enablerURL,
kCFURLPOSIXPathStyle),
+ stringToFind,
+ 0
+ );
+
+ CFRange validRange;
+ validRange.location = 0;
+ validRange.length = discardRange.location - 1;
+
+ CFStringRef dirPathCFString = CFStringCreateWithSubstring (
+ kCFAllocatorDefault,
+ rawPath,
+ validRange
+ );
+
+ CFStringGetCString (
+ dirPathCFString,
+ dirPath,
+ PATH_MAX,
+ encoding
+ );
+ }
+ else
+ {
+ getcwd(dirPath, PATH_MAX);
+ }
+ }
+}
+
+bool SC_StandAloneInfo::IsStandAlone() {
+ if ( !haveCheckedBundleStatus )
+ {
+ SC_StandAloneInfoInit();
+ }
+ return sIsStandAlone;
+}
+
+void SC_StandAloneInfo::GetResourceDir(char* pathBuf, int length)
+{
+ if ( !haveCheckedBundleStatus )
+ {
+ SC_StandAloneInfoInit();
+ }
+ strncpy(pathBuf, dirPath, length);
+
+}
+
+#endif
--- /dev/null 2006-01-05 22:40:29.000000000 -0800
+++ ./headers/common/SC_StandAloneInfo_Darwin.h 2006-01-05
13:15:44.000000000 -0800
@@ -0,0 +1,21 @@
+#ifdef SC_DARWIN
+
+#ifndef _SC_StandAloneInfo_
+#define _SC_StandAloneInfo_
+#endif
+
+class SC_StandAloneInfo;
+
+class SC_StandAloneInfo
+{
+private:
+ static bool sIsStandAlone;
+ static bool haveCheckedBundleStatus;
+ static char dirPath[PATH_MAX];
+
+ static void SC_StandAloneInfoInit();
+public:
+ static bool IsStandAlone();
+ static void GetResourceDir(char* pathBuf, int length);
+};
+#endif