swift常用文件目录

    let home = NSHomeDirectory()
    print("整个应用程序各文档所在的目录:\(home)")
    
    let document = NSHomeDirectory() + "/Documents"
    print("用户文档目录:\(document)")
    
    let library = NSHomeDirectory() + "/Library"
    print("Library目录:\(library)包含Caches和Preferences")
    
    let cache = NSHomeDirectory() + "/Library/cache"
    print("缓存文件目录:\(cache)")
    print("Preferences不应该直接创建文件,而是使用NSUserDefaults类获取和设置")
    
    let temp = NSTemporaryDirectory()
    print("临时文件目录:\(temp)")

你可能感兴趣的:(swift常用文件目录)