     /* -URLsForDirectory:inDomains: is analogous to NSSearchPathForDirectoriesInDomains(), but returns an array of NSURL instances for use with URL-taking APIs. This API is suitable when you need to search for a file or files which may live in one of a variety of locations in the domains specified.
      */
     open func urls(for directory: SearchPathDirectory, in domainMask: SearchPathDomainMask) -> [URL] {
-        guard let domain = _SearchPathDomain(domainMask) else {
-            fatalError("Values other than .systemDomainMask, .localDomainMask, .userDomainMask, .networkDomainMask are unsupported")
-        }
+        let domains = _SearchPathDomain.allInSearchOrder(from: domainMask)
         
         // We are going to return appropriate paths on Darwin, but [] on platforms that do not have comparable locations.
         // For example, on FHS/XDG systems, applications are not installed in a single path.

        case network
        case user
        
        init?(_ domainMask: SearchPathDomainMask) {
            if domainMask == .systemDomainMask {
                self = .system; return
            }
            if domainMask == .localDomainMask {
                self = .local; return
            }
            if domainMask == .networkDomainMask {
                self = .network; return
            }
            if domainMask == .userDomainMask {
                self = .user; return
            }
            
            return nil
        }
    }
    

            #endif
        }
        
        var urls: [URL] = []
        
        for domain in domains {
            if useDarwinPaths {
                urls.append(contentsOf: darwinURLs(for: directory, in: domain))
            } else {
                urls.append(contentsOf: xdgURLs(for: directory, in: domain))
            }
        }
        
        return urls
    }
    #endif
    
