Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions OgreMain/include/OSX/macUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ namespace Ogre {
_OgreExport String macTempFileName(void);
_OgreExport String macResourcesPath();
_OgreExport String macLogPath();
_OgreExport String macWriteAccessFolderPath();
_OgreExport void mac_dispatchOneEvent();
}
17 changes: 17 additions & 0 deletions OgreMain/src/OSX/macUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,23 @@ String macLogPath()
NSURL* logURL = [libURL URLByAppendingPathComponent: @"Logs" isDirectory: YES];
return String( logURL.absoluteURL.path.UTF8String ) + "/";
}

String macWriteAccessFolderPath()
{
NSURL* suppURL = [NSFileManager.defaultManager
URLForDirectory: NSApplicationSupportDirectory
inDomain: NSUserDomainMask
appropriateForURL: nil
create: YES
error: nil];
NSURL* ogreURL = [suppURL URLByAppendingPathComponent: @"Ogre"
isDirectory: YES];
[NSFileManager.defaultManager createDirectoryAtURL: ogreURL
withIntermediateDirectories: YES
attributes: nil
error: nil];
return String( ogreURL.absoluteURL.path.UTF8String ) + "/";
}

String macCachePath()
{
Expand Down
4 changes: 3 additions & 1 deletion Samples/2.0/Common/src/GraphicsSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,16 @@ namespace Demo
#endif
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
mPluginsFolder = mResourcePath;
#endif
mWriteAccessFolder = Ogre::macWriteAccessFolderPath();
#else
if( isWriteAccessFolder( mPluginsFolder, "Ogre.log" ) )
mWriteAccessFolder = mPluginsFolder;
else
{
Ogre::FileSystemLayer filesystemLayer( OGRE_VERSION_NAME );
mWriteAccessFolder = filesystemLayer.getWritablePath( "" );
}
#endif
}
//-----------------------------------------------------------------------------------
GraphicsSystem::~GraphicsSystem()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ int main( int argc, const char *argv[] )

#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
const String pluginsFolder = macResourcesPath();
const String writeAccessFolder = macLogPath();
const String writeAccessFolder = macWriteAccessFolderPath();
#else
const String pluginsFolder = "./";
const String writeAccessFolder = pluginsFolder;
Expand Down