title: Is there something im not understaning about the fileExistsAtPath:isDirectory method?
body: <p>I do not understand how this method works. Here is the code</p>
  
  <pre><code>BOOL isDir = NULL;
  BOOL returnVal;
  path = @"/Users/me/Desktop/kkk";
  returnVal = [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&amp;isDir];
  </code></pre>
  
  <p>And here are the results if:</p>
  
  <p>1) kkk is a file</p>
  
  <pre><code>returnVal = NO
  isDir     = NO
  </code></pre>
  
  <p>2) kkk is an empty directory</p>
  
  <pre><code>returnVal = YES
  isDir     = YES
  </code></pre>
  
  <p>Scenario #2 seems to work as expected, but according to the documentation:</p>
  
  <pre><code>path
  The path of a file or directory. If path begins with a tilde (~), it must first be expanded with stringByExpandingTildeInPath, or this method will return NO. 
  
  isDirectory
  Upon return, contains YES if path is a directory or if the final path element is a symbolic link that points to a directory, otherwise contains NO. If path doesn’t exist, this value is undefined upon return. Pass NULL if you do not need this information.
  </code></pre>
  
  <p>So for scenario #1 shouldnt the result be the following?</p>
  
  <pre><code>returnVal = YES
  isDir     = NO
  </code></pre>
  
  <p><strong>1) Edit</strong>
  For the comments below.</p>
  
  <p>But the files do exist. I create the file manually to test it. lol. its only a program with 4 lines of code. I have both file/folder on the desktop. First i put a file there called "kkk" (with no extention) then i remove the file and place a folder there called "kkk".  It works for the folder, but not for the file.  Interestingly, if the file <em>has</em> an extension, it works. So is there something wrong with a file with no extension ? (are you guys still not able to reproduce it with no extention?)</p>
  
  <p><strong>2) EDIT</strong></p>
  
  <p>Thanks for helping me solve this guys. I have my Mac set to display the extension of files. But it seems Mac as an odd behavior. I select the file "kk.plist" and then rename the file to "kk" as you see in the image. As soon as i do this Mac OSx automatically selects the hide extension option. So when i thought the file was "kk", it was still "kk.plist" with its extension hidden.  As you can see, both files have the same extension, one is hidden, the other is not. I didnt realize hidden extensions can be applied to one file only. Thanks.</p>
  
  <p><img src="https://i.stack.imgur.com/ViJsM.png" alt="enter image description here"></p>