使用C ++访问OS X上的标准目录 [英] Accessing Standard Directories on OS X with C++

查看:76
本文介绍了使用C ++访问OS X上的标准目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从C ++访问OS X上的标准目录(例如~/Library/Application Support~/Library/Preferences)的现代,标准,规范方法是什么?

What is the modern, standard, canonical method for accessing standard directories on OS X from C++, such as ~/Library/Application Support or ~/Library/Preferences?

我已经提到使用 CoreServices 的用法,但它也提到它已被弃用,我很难找到可以使我做更多的文档,而不仅仅是粘贴代码.

I've seen mention of the use CoreServices, but it's also mentioned that it's deprecated and I'm having trouble finding the documentation that will allow me to do more than just paste the code in.

我发现提到过使用Objective C ++,但是有关该选项的大多数信息都围绕从Objective C调用C ++代码,再次,Apple的文档似乎很少,或者至少我没有成功找到它

I've found mention of using Objective C++, but most information about that option revolves around calling C++ code from Objective C, and again, Apple's documentation on it seems rather sparse, or at least I've not had success finding it.

推荐答案

看看下面的技术问答用于解决在您不想拉入NS名称空间的环境中的波浪号扩展的: https://developer.apple.com/library/mac/qa/qa1549/_index.html

Have a look at the following Technical Q & A that addresses tilde expansion in an environment where you won't want to pull in the NS namespaces: https://developer.apple.com/library/mac/qa/qa1549/_index.html

我还没有遇到类似于NSString的expandTildeAtPath的内置CoreFoundation调用.至于您提到的CoreServices示例,其中包括FsRefs.这些是较早的Carbon调用和用于处理系统文件的对象.这些已弃用,而不是CoreFoundation.

I have not encountered built-in CoreFoundation calls that are similar to NSString's expandTildeAtPath. As for the CoreServices example you mentioned, which included FsRefs. These were older Carbon calls and objects to work with system files. Those have been deprecated, not CoreFoundation.

这篇关于使用C ++访问OS X上的标准目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆