Objective-C 中基于波浪号的路径 [英] Tilde-based Paths in Objective-C

查看:55
本文介绍了Objective-C 中基于波浪号的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Objective-C 中,如何将基于波浪号的路径名转换为完整路径名?也就是说,我想从 ~/sandbox 转换为 /Users/TheBobs/sandbox.

In Objective-C, how do I go about converting tilde-based pathnames to full pathnames? That is, I'd like to convert from ~/sandbox to /Users/TheBobs/sandbox.

推荐答案

使用 NSString 的 stringByExpandingTildeInPath: 方法.

Use NSString's stringByExpandingTildeInPath: method.

还有其他几种方法可以轻松使用路径.

There are also several other methods that make it easy to work with paths.

这篇关于Objective-C 中基于波浪号的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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