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
void CheckLists (TowerList *TL, UnitList *UL, UnitList *SQ, PathList *PL, FunctionQueue *FQ)
{
    if (!TowerEmpty(TL))
    {
        TowerClear(TL);
    }
    if (!UnitEmpty(UL))
    {
        UnitClear(UL);
    }
    if (!UnitEmpty(SQ))
    {
        UnitClear(SQ);
    }
    if (!PathEmpty(PL))
    {
        PathClear(PL);
    }
    if (!FunctionEmpty(FQ))
    {
        FunctionClear(FQ);
    }
}