Update of /cvsroot/simspark/simspark/spark/salt
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21238
Modified Files:
Tag: projectx
fileclasses.cpp
Log Message:
- include corefoundation header
- changed config.h to sparkconfig.h
Index: fileclasses.cpp
===================================================================
RCS file: /cvsroot/simspark/simspark/spark/salt/fileclasses.cpp,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.1.2.1
diff -C2 -d -r1.1.2.1 -r1.1.2.1.2.1
*** fileclasses.cpp 13 Feb 2007 19:42:14 -0000 1.1.2.1
--- fileclasses.cpp 30 Mar 2007 03:50:31 -0000 1.1.2.1.2.1
***************
*** 1,5 ****
! /* -*- mode: c++ -*-
! this file is part of rcssserver3D
Fri May 9 2003
Copyright (C) 2003 Koblenz University
--- 1,5 ----
! /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
! this file is part of simspark
Fri May 9 2003
Copyright (C) 2003 Koblenz University
***************
*** 23,26 ****
--- 23,34 ----
#include <cstring>
+ #if HAVE_CONFIG_H
+ #include <sparkconfig.h>
+ #endif
+
+ #if HAVE_COREFOUNDATION_COREFOUNDATION_H
+ #include <CoreFoundation/CoreFoundation.h>
+ #endif
+
namespace salt
{
***************
*** 40,43 ****
--- 48,89 ----
using namespace salt;
+ std::string
+ RFile::Sep()
+ {
+ #ifdef WIN32
+ return "\\";
+ #else
+ return "/";
+ #endif
+ }
+
+ std::string
+ RFile::BundlePath()
+ {
+ #if HAVE_COREFOUNDATION_COREFOUNDATION_H
+ char path[1024];
+ CFBundleRef mainBundle = CFBundleGetMainBundle();
+ assert(mainBundle);
+
+ CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
+ assert(mainBundleURL);
+
+ CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
+ assert(cfStringRef);
+
+ CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);
+
+ CFRelease(mainBundleURL);
+ CFRelease(cfStringRef);
+
+ return std::string(path) + Sep();
+ #else
+ # ifdef PREFIX
+ return PREFIX + Sep() + "share" + Sep() + PACKAGE_NAME;
+ # else
+ return "." + Sep();
+ # endif
+ #endif
+ }
//------------------------------------------------------------------------------------------------
|