title: How to get path to the parent folder of a certain directory?
body: <p>When I would have this directory path:</p>
  
  <pre class="lang-none prettyprint-override"><code>C:\Program Files (x86)\Embarcadero\
  </code></pre>
  
  <p>The function I'm looking for should return:</p>
  
  <pre class="lang-none prettyprint-override"><code>C:\Program Files (x86)\
  </code></pre>
  
  <p>I've tried this code but it works only for files, not for directories:</p>
  
  <pre><code>function GetParentDirectory(const Path: string): string;
  begin
    Result := ExpandFileName(Path);
  end;
  </code></pre>
  
  <p>Does anyone know what should I use to return path to the parent folder of a certain directory ?</p>