开发者

HTTP server on iPhone?

开发者 https://www.devze.com 2023-03-19 07:57 出处:网络
I am using cocoa http server on iPhone. Its working fine if I set a root document. But I want to list all the contents of my \"Document directory\". I tried setting the root document to the document\'

I am using cocoa http server on iPhone. Its working fine if I set a root document. But I want to list all the contents of my "Document directory". I tried setting the root document to the document's directory path

NSArray *directories = NSSearchPa开发者_高级运维thForDirectoriesInDomains(NSDocumentsDirectory, NSUserDomainMask, YES);
NSString *rootDir = [directories lastObject];
[httpServer setDocumentRoot:rootDir];

(I tried getting the path programatically)

But its not working ... any idea on this or is there any opensource project that I can use to list the content of my document directory?

Update : here is link to the project (cocoa http server)


You could try Mongoose and it's Objective-C Wrapper. It seems Mongoose natively supports directory listing.


You must use;

NSArray *directories = NSSearchPathForDirectoriesInDomains(NSDocumentsDirectory, NSUserDomainMask, YES);
NSString *rootDir = [directories lastObject];
[httpServer setDocumentRoot:rootDir];

because the GUID for the app changes on every install (i.e. the number starting with 8D41 in your dir above).

0

精彩评论

暂无评论...
验证码 换一张
取 消