diff --git a/src/mp_app.h b/src/mp_app.h index 03e5afd..0c6f954 100644 --- a/src/mp_app.h +++ b/src/mp_app.h @@ -416,6 +416,7 @@ int mp_alert_popup(const char* title, // file system stuff... //TODO: move elsewhere //-------------------------------------------------------------------- int mp_file_move(str8 from, str8 to); +int mp_file_remove(str8 path); #ifdef __cplusplus } // extern "C" diff --git a/src/osx_app.m b/src/osx_app.m index 63db0c5..26dcc81 100644 --- a/src/osx_app.m +++ b/src/osx_app.m @@ -2635,5 +2635,18 @@ int mp_file_move(str8 from, str8 to) } }} +int mp_file_remove(str8 path) +{@autoreleasepool{ + NSString* nsPath = [[NSString alloc] initWithBytes:path.ptr length:path.len encoding: NSUTF8StringEncoding]; + NSError* err; + if([[NSFileManager defaultManager] removeItemAtPath:nsPath error:&err] == YES) + { + return(0); + } + else + { + return(-1); + } +}} #undef LOG_SUBSYSTEM