Exemplo n.º 1
0
/*======================================================================
   Purpose:	Remove a file.
   Returns:	TRUE	file removed
				FALSE	unable to remove file
   Notes:	
   Revised:
		15Dec04	PLD	remove check for open file; sopen not *nix-compatible
							after all
		08Dec04	PLD	add check for open file: attempt to open it with
							exclusive access.
----------------------------------------------------------------------*/
static BOOL RemoveEventFile(CHAR *path)
   {

   ASSERT(path != NULL);

   /* Delete the file... */
   if (remove(path) < 0)
      {
      ArchiveLog(ARC_LOG_ERRORS, "Purge: unable to remove file: %s", path);
      return FALSE;
      }

   /* Remove emtpy stream directory */
   if (!TrimPath(path, 1))
      return FALSE;
   if (!PathEmpty(path))
      return TRUE;
   ArchiveLog(ARC_LOG_VERBOSE, "Purge: removing %s", path);
   if (!DestroyPath(path))
      {
      ArchiveLog(ARC_LOG_ERRORS, "Purge: unable to remove directory: %s - %s", path, FileErrorString(FileLastError()));
      return FALSE;
      }

   /* Remove empty unit directory */
   if (!TrimPath(path, 1))
      return FALSE;
   if (!PathEmpty(path))
      return TRUE;
   ArchiveLog(ARC_LOG_VERBOSE, "Purge: removing %s", path);
   if (!DestroyPath(path))
      {
      ArchiveLog(ARC_LOG_ERRORS, "Purge: unable to remove directory: %s - %s", path, FileErrorString(FileLastError()));
      return FALSE;
      }

   /* Remove empty day directory */
   if (!TrimPath(path, 1))
      return FALSE;
   if (!PathEmpty(path))
      return TRUE;
   ArchiveLog(ARC_LOG_VERBOSE, "Purge: removing %s", path);
   if (!DestroyPath(path))
      {
      ArchiveLog(ARC_LOG_ERRORS, "Purge: unable to remove directory: %s - %s", path, FileErrorString(FileLastError()));
      return FALSE;
      }

   return TRUE;
   }  /* end RemoveEventFile() */
Exemplo n.º 2
0
QString RipCD::GetOutputFileName(const QString& input,
                                 const TranscoderPreset& preset) const {
  QString path =
      ui_->destination->itemData(ui_->destination->currentIndex()).toString();
  if (path.isEmpty()) {
    // Keep the original path.
    return input.section('.', 0, -2) + '.' + preset.extension_;
  } else {
    QString file_name = TrimPath(input);
    file_name = file_name.section('.', 0, -2);
    return path + '/' + file_name + '.' + preset.extension_;
  }
}