title: filesystem parent path and a ".." string to get back to parent path
body: <p>Im not using boost, im using C++17's filesystem which is basically based on boosts filesystem.</p>
  <p>I want to list directories, filenames and parent directory shortcut &quot;..&quot; using C++ filesystem.
  I have no problem adding directories and filenames to a list, I do it this way:</p>
  <pre><code>string path=&quot;C:\something\test&quot;;
  
  //add missing code here:
  //should find: &quot;..&quot; or not.
  
  //add directories to list
  for (auto&amp; p : directory_iterator(path))
  {
      if (p.is_directory())
      {
          string name = p.path().filename().string();
          list[index].push_back(name);
      }
  }
  
  //add files to list
  for (auto&amp; p : directory_iterator(path))
  {
      if (!p.is_directory())
      {
          string filename = p.path().filename().string();   //hele filnavnet (med filtype)
          list[index].push_back(filename);
      }
  }
  </code></pre>
  <p>This is working well and fine, but the problem is im missing the &quot;..&quot; if i am in a sub-directory like C:\something\test\ path. I want to find out wether or not there is a parent path available, whats the easiest way to do this using filesystem?</p>
  <p>And also the same thing if the path is &quot;C:&quot;, then my program should say that &quot;..&quot; is not available.
  Basically the list could be looking like something like this if i am in C:\something\test\</p>
  <pre><code>..
  AnotherDirectory
  YetAnotherDirectory
  file1.txt
  file2.txt
  etc.txt
  </code></pre>
  <p>and if i am in &quot;C:&quot;
  a list would look something like this (without the &quot;..&quot;)</p>
  <pre><code>Something
  Directory2
  file1.txt
  command.com
  autoexec.but
  config.lol
  </code></pre>