nsFileSpec parent; cwd.GetParent(parent); parent.GetParent(cwd);
cwd.GetParent(cwd);
static void GetDefaultUserProfileRoot(nsFileSpec& outSpec)// UNIX    : ~/.mozilla/// WIN    : Program Files\Netscape\Users50\  // Mac    : :Documents:Mozilla:Users50://----------------------------------------------------------------------------------------{#if defined(XP_MAC)    nsSpecialSystemDirectory cwd(nsSpecialSystemDirectory::Mac_DocumentsDirectory);    cwd += "Mozilla";    if (!cwd.Exists())        cwd.CreateDir();    cwd += "Users50";    if (!cwd.Exists())        cwd.CreateDir();#elif defined(XP_UNIX)      nsSpecialSystemDirectory cwd(nsSpecialSystemDirectory::Unix_HomeDirectory);    cwd += ".mozilla";    if (!cwd.Exists())        cwd.CreateDir();#elif defined(XP_PC)    // set its directory an aunt of the executable.    nsSpecialSystemDirectory cwd(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);    // That's "program files\Netscape\Communicator\Program"    nsFileSpec parent;    cwd.GetParent(parent); // "program files\Netscape\Communicator"    parent.GetParent(cwd); // "program files\Netscape\"    cwd += "Users50";    if (!cwd.Exists())        cwd.CreateDir();#elif defined(XP_BEOS)    nsSpecialSystemDirectory cwd(nsSpecialSystemDirectory::BeOS_SettingsDirectory);    cwd += "mozilla";    if (!cwd.Exists())        cwd.CreateDir();#else#error dont_know_how_to_do_profiles_on_your_platform#endif    outSpec = cwd;} // GetDefaultUserProfileRoot