/**************************************************************************** Aaru Data Preservation Suite ----------------------------------------------------------------------------- Filename : macos.c Author(s) : Natalia Portillo --[ Description ] ----------------------------------------------------------- Contains Mac OS code. --[ License ] --------------------------------------------------------------- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ----------------------------------------------------------------------------- Copyright (C) 2011-2021 Natalia Portillo *****************************************************************************/ #if defined(macintosh) #include #include #include #include #include #include #include #include #include #include #include #include "../include/consts.h" #include "../include/defs.h" #include "macos.h" void DeleteFiles(const char* path) { OSErr rc, wRc, cRc; Str255 str255; HVolumeParam hpb; int16_t refNum; int16_t refFile; int32_t dirId; FInfo finderInfo; int32_t count; char filename[9]; int pos = 0; snprintf((char*)str255, 255, "%s", path); hpb.ioNamePtr = str255; hpb.ioVRefNum = 0; hpb.ioVolIndex = -1; rc = PBHGetVInfo((HParmBlkPtr)&hpb, 0); if(rc) { printf("Could not get volume information.\n"); return; } refNum = hpb.ioVRefNum; rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pDELETED", &dirId); if(rc) { printf("Error %d creating working directory.\n", rc); return; } printf("Creating and deleting files.\n"); for(pos = 0; pos < 64; pos++) { memset(&filename, 0, 9); sprintf((char*)filename, "%08d", pos); str255[0] = 8; memcpy(str255 + 1, filename, 8); rc = HCreate(refNum, dirId, str255, ostUnknown, ftGenericDocumentPC); if(rc) break; HDelete(refNum, dirId, str255); } } #endif