# File::nonexistant is a directory

**URL:** <https://forum.juce.com/t/file-nonexistant-is-a-directory/1468>\
**Category:** General JUCE discussion\
**Created:** [February 13, 2007, 10:43pm UTC](https://forum.juce.com/t/file-nonexistant-is-a-directory/1468 "2007-02-13T22:43:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RolandMR](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rolandmr/32/641_2.png) [@RolandMR](https://forum.juce.com/u/RolandMR)\
**Post date:** [February 13, 2007, 10:43pm UTC](https://forum.juce.com/t/file-nonexistant-is-a-directory/1468/1 "2007-02-13T22:43:25Z")

</div>

I brought this up before, but it just bit me in the ass again, so I thought I’d warn everybody.

```auto
File f(File::nonexistant);
if (f.isDirectory())
  jassertfalse;
```

This will assert on linux and the mac and not on the pc.

On linux and the mac, the root directory and non existent are the same thing.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [February 14, 2007, 9:40am UTC](https://forum.juce.com/t/file-nonexistant-is-a-directory/1468/2 "2007-02-14T09:40:13Z")

</div>

Yes, it’s a bit of a tricky one, that.

The reason is that that directory names are stored without the trailing “/”, so File (“/”) is stored internally as an empty string, and that’s the same as the non-existent file. I’ll try to think of with a better plan, but ideas are welcome on the subject!

---

<div class="post-metadata">

**Author:** ![valley](https://avatars.discourse-cdn.com/v4/letter/v/67e7ee/32.png) [@valley](https://forum.juce.com/u/valley)\
**Post date:** [February 14, 2007, 3:43pm UTC](https://forum.juce.com/t/file-nonexistant-is-a-directory/1468/3 "2007-02-14T15:43:20Z")

</div>

add . support?

. would correctly map to the root directory, but not end with a trailing slash.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [February 14, 2007, 5:16pm UTC](https://forum.juce.com/t/file-nonexistant-is-a-directory/1468/4 "2007-02-14T17:16:21Z")

</div>

Hmm. That’s pretty good thinking…

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 12, 2017, 8:57pm UTC](https://forum.juce.com/t/file-nonexistant-is-a-directory/1468/5 "2017-05-12T20:57:59Z")

</div>

Closed on May 12, 2017, 8:57pm UTC


