diff --git a/src/frameworks/CoreServices/FileManager.cpp b/src/frameworks/CoreServices/FileManager.cpp index 81fc7f6f6..2ce048acc 100644 --- a/src/frameworks/CoreServices/FileManager.cpp +++ b/src/frameworks/CoreServices/FileManager.cpp @@ -123,6 +123,18 @@ bool FSRefParamMakePath(const FSRefParam* param, std::string& out) return false; } +OSStatus FSDeleteObject(const FSRef* fsref) +{ + std::string path; + if (FSRefMakePath(fsref, path)) + { + if (::unlink(path.c_str()) == -1) + return makeOSStatus(errno); + return noErr; + } + return fnfErr; +} + OSStatus FSRefMakePath(const FSRef* fsref, uint8_t* path, uint32_t maxSize) { std::string rpath; diff --git a/src/frameworks/CoreServices/include/CoreServices/FileManager.h b/src/frameworks/CoreServices/include/CoreServices/FileManager.h index 813894557..9eb1866a2 100644 --- a/src/frameworks/CoreServices/include/CoreServices/FileManager.h +++ b/src/frameworks/CoreServices/include/CoreServices/FileManager.h @@ -216,6 +216,7 @@ OSStatus FSRefMakePath(const struct FSRef* fsref, uint8_t* path, uint32_t maxSiz Boolean CFURLGetFSRef(CFURLRef urlref, struct FSRef* fsref); // in CF CFURLRef CFURLCreateFromFSRef(CFAllocatorRef alloc, struct FSRef* location); // --> in CF OSStatus FSFindFolder(long vRefNum, OSType folderType, Boolean createFolder, struct FSRef* location); +OSStatus FSDeleteObject(const FSRef* fsref); OSStatus FSGetCatalogInfo(const FSRefPtr ref, uint32_t infoBits, struct FSCatalogInfo* infoOut, struct HFSUniStr255* nameOut, FSSpecPtr fsspec, FSRefPtr parentDir);