PDA

View Full Version : using frameworks in proton code



caboose89
02-14-2012, 10:11 AM
Hi all,

Just a quick question, as i'm unable to fix this myself. I'm trying to access NSFileManager in a Proton window.
Is there any way I can access this framework class? I've tried:
#include "Foundation/NSFileManager.h"
#include "Foundation.NSFileManager.h"
#include "Foundation.framework/NSFileManager.h"
#include "NSFileManager.h"

and #import "Foundation/NSFilemanager" causes parse / compile issues in NSObjectRuntime.h

The reason for requireing this class is that i need a directory listing from the iPhone's photos library, as I cant seem to implement directory listings with the FileManager class, as much as I may try.

Any advice is much appriciated,

Regards,

Caboose.

Seth
02-14-2012, 11:40 AM
Hi all,

Just a quick question, as i'm unable to fix this myself. I'm trying to access NSFileManager in a Proton window.
Is there any way I can access this framework class? I've tried:
#include "Foundation/NSFileManager.h"


The file extension has to be .mm to mix C/C++ and ObjC. Then you can use #import and such without errors in xcode.

Take a look at /shared/android/iOSUtils.mm for an example - I even use NSFileManager in it.

Also, on each platform, Proton has these implemented (not part of FileManager), in case you didn't see 'em:


void RemoveFile(std::string fileName, bool bAddSavePath = true);
void CreateDirectoryRecursively(std::string basePath, std::string path);
bool RemoveDirectoryRecursively(std::string path);
std::vector<std::string> GetDirectoriesAtPath(std::string path);
std::vector<std::string> GetFilesAtPath(std::string path);


Guess those won't help with getting the documents path to feed into them though...

caboose89
02-14-2012, 11:46 AM
Hi Seth,

Thanks again. I just managed to crack this issue by renaming the cpp file extension, and was on my way to withdraw my question, to see you had beaten me to it! :)

Thanks for the pointers to the functions; i have a feeling they will come in handy.

Thanks again,

Caboose