         do {
             #if swift(>=3.0)
                 let dirpath =  NSURL(fileURLWithPath:path).deletingLastPathComponent?.path ?? ""
+                //print("dirpath: \(dirpath)")
                 let fm = FileManager.default
                 try fm.createDirectory(atPath: dirpath, withIntermediateDirectories:true, attributes:nil)
             #else

#endif

public func SearchPathForDirectoriesInDomains(_ directory: FileManager.SearchPathDirectory, _ domainMask: FileManager.SearchPathDomainMask, _ expandTilde: Bool) -> [String] {
    switch directory {
    case .libraryDirectory:
        let fileManager = FileManager.default
        return [fileManager.currentDirectoryPath + "/Library"]
    default:
    break
    }
    return [""]
}

        #else
            let path = NSURL(fileURLWithPath: getLibraryPath(), isDirectory: true).URLByAppendingPathComponent(name).path ?? ""
        #endif
        return self.init(path: path, name: name)
    }
    
    class func getLibraryPath() -> String {
