> On Mar 10, 2017, at 12:32 PM, Proyb P via swift-users
> wrote:
>
> MacOS shown different behavior.
Running a playground using Xcode 8.2.1 on macOS 10.12.3 your code returns true
and the isDir value is also true.
Are you sure the directory “files” exists on your macOS test environment?
let
MacOS shown different behavior.
On Saturday, 11 March 2017, John Smith 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/“.
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
> wrote:
>
> let filename
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