MacOS shown different behavior. On Saturday, 11 March 2017, John Smith <jsmith5...@yahoo.com> wrote:
> That is correct as long as the directory “files/“ exists. filename is set > to an empty string this your concat statement appends an empty string to > your constant string of “files/“ resulting in the path “files/“. > > > > On Mar 10, 2017, at 1:53 PM, Proyb P via swift-users < > swift-users@swift.org <javascript:;>> wrote: > > > > let filename = "" > > let checkfile = FileManager.default > > var isDir : ObjCBool = false > > if checkfile.fileExists(atPath: "files/"+filename, isDirectory: &isDir) { > > print("true") > > } else { > > print("false") > > } > > > > On Linux, if the "filename" variable is empty string, checkfile will > returns as true which should be return as false since the file is not > found. macOS is working fine. > > > > A temporary workarounds is to use > > let filename = "NOTFOUND" > > _______________________________________________ > > swift-users mailing list > > swift-users@swift.org <javascript:;> > > https://lists.swift.org/mailman/listinfo/swift-users > >
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users