【发布时间】:2011-07-11 22:23:01
【问题描述】:
我正在将我的 iOS 项目移植到 Mac
我保存了几个文件,在 iOS 上,我将它保存在 Documents/ 下的 .app 中,但是,MAC OSX 没有创建文件
/Users/SMTH/Desktop/Development/SIO2 2/SIO2_SDK/tutorials/MyMacApp/macos/build/Debug/00_template.app/Contents/MacOS/../Documents/menustate.sav
使用
std::ofstream file;
file.open(fpath.c_str(), std::ios::out | std::ios::binary);
我是在做某事。错误的。或者我不能像 iOS 应用一样在 Mac OSX 应用中保存(然后在 MAC 上保存在哪里?)
编辑:我还尝试了其他位置,例如
file.open("~/Documents/menustate.sav", std::ios::out | std::ios::binary); 但仍然没有创建文件
唯一可保存的路径是“./”->“./menustate.sav”,它将它保存到 somepath/00_template.app/Contents/Resources' 但为什么可以它保存到资源,而不是其他地方?
谢谢
【问题讨论】: