inline void MacroAssembler::trap_zombie_not_entrant() {
  tdi(traptoUnconditional, 0/*reg 0*/, 1);
}
Exemple #2
0
bool FileArchiveManager::AddFileToArchive(const QString& filePathName, bool systemTrashOriginalFile,
                                          const QString& folderHint, const QString& groupHint,
                                          const QString& errorWhileContext, QString& fileArchiveURL)
{
    //This is like an assert.
    if (!filesTransaction->isTransactionStarted())
        return Error(QString("Error while %1:\n"
                             "No file transaction was started before adding files to archive.")
                     .arg(errorWhileContext));

    //Check if file is valid.
    QFileInfo fi(filePathName);
    if (!fi.exists())
        return Error(QString("Error while %1:\nThe selected file \"%2\" does not exist!")
                     .arg(errorWhileContext, filePathName));
    else if (!fi.isFile())
        return Error(QString("Error while %1:\nThe path \"%2\" does not point to a valid file!")
                     .arg(errorWhileContext, filePathName));

    //Decide where should the file be copied.
    QString fileRelArchiveURL = CalculateFileArchiveURL(filePathName, folderHint, groupHint);
    if (fileRelArchiveURL.isEmpty())
        return false;

    QString targetFilePathName = GetFullArchivePathForRelativeURL(fileRelArchiveURL);
    fileArchiveURL = m_archiveName + "/" + fileRelArchiveURL; //Out param

    //Create its directory if doesn't exist.
    QString targetFileDir = QFileInfo(targetFilePathName).absolutePath();
    QFileInfo tdi(targetFileDir);
    if (!tdi.exists())
    {
        //Can NOT use `canonicalFilePath`, since the directory still doesn't exist, it will just
        //  return an empty string.
        if (!filesTransaction->MakePath(".", tdi.absoluteFilePath()))
            return Error(QString("Error while %1:\nCould not create the directory for placing "
                                 "the attached file.\n\nDirectory: %2")
                         .arg(errorWhileContext, tdi.absoluteFilePath()));
    }
    else if (!tdi.isDir())
    {
        return Error(QString("Error while %1:\nThe path for placing the attached file is not a directory!"
                     "\n\nDirectory: %2").arg(errorWhileContext, tdi.absoluteFilePath()));
    }

    //Copy the file.
    bool success = filesTransaction->CopyFile(filePathName, targetFilePathName);
    if (!success)
        return Error(QString("Error while %1:\n"
                             "Could not copy the source file to destination directory!"
                             "\n\nSource File: %2\nDestination File: %3")
                             .arg(errorWhileContext, filePathName, targetFilePathName));

    //Remove the original file.
    if (systemTrashOriginalFile)
    {
        bool Trashsuccess = filesTransaction->SystemTrashFile(filePathName);
        //We do NOT return FALSE in case of failure.
        if (!Trashsuccess)
        {
            Error(QString("Error while %1:\nCould not delete the original file from your filesystem. "
                          "You should manually delete it yourself.\n\nFile: %2")
                  .arg(errorWhileContext, filePathName));
        }
    };

    return true;
}
inline void MacroAssembler::trap_null_check(Register a, trap_to_bits cmp) {
  assert(TrapBasedNullChecks, "sanity");
  tdi(cmp, a/*reg a*/, 0);
}