dirPath += filePath.GetLeafName();
char* leafName = filePath.GetLeafName(); dirPath += leafName; nsCRT::free(leafName);
int FilesTest::Copy(const char* file, const char* dir)//----------------------------------------------------------------------------------------{    nsFileSpec dirPath(dir, PR_TRUE);            dirPath.CreateDirectory();    if (! dirPath.Exists())        return Failed();        nsFileSpec mySpec(file, PR_TRUE); // relative path.    {        nsIOFileStream testStream(mySpec); // creates the file        // Scope ends here, file gets closed    }        nsFileSpec filePath(file);    if (! filePath.Exists())        return Failed();       nsresult error = filePath.Copy(dirPath);    dirPath += filePath.GetLeafName();    if (! dirPath.Exists() || ! filePath.Exists() || NS_FAILED(error))        return Failed();   return Passed();}