I am trying to figure out the intend usage of QDir::mkpath

On Qt 4.3 on windows XP

Qt Code:
  1. Qdir dir("John");
  2.  
  3. dir.mkpath("Kathy");
To copy to clipboard, switch view to plain text mode 

The result is John/Kathy which is not what I expected especially because my intended usage was as follows.

Qt Code:
  1. QDir dir("John");
  2.  
  3. if (!dir.exists()) {
  4. dir.mkpath("John");
  5. }
To copy to clipboard, switch view to plain text mode 

However the result is

John/John
is created.

I tried
Qt Code:
  1. QDir dir("John");
  2.  
  3. if (!dir.exists()) {
  4. dir.mkpath(".");
  5. }
To copy to clipboard, switch view to plain text mode 

and got what I wanted (created just John in the current folder) however I am unsure that this will work on all platforms.

Also if you

Qt Code:
  1. QDir dir("John");
  2.  
  3. if (!dir.exists()) {
  4. dir.mkpath("");
  5. }
To copy to clipboard, switch view to plain text mode 

it exits with false because the path can not be empty.