diff --git a/src/mp_app.h b/src/mp_app.h index cf5e3c3..03e5afd 100644 --- a/src/mp_app.h +++ b/src/mp_app.h @@ -411,6 +411,12 @@ int mp_alert_popup(const char* title, u32 count, const char** options); + +//-------------------------------------------------------------------- +// file system stuff... //TODO: move elsewhere +//-------------------------------------------------------------------- +int mp_file_move(str8 from, str8 to); + #ifdef __cplusplus } // extern "C" #endif diff --git a/src/osx_app.m b/src/osx_app.m index 13ce595..63db0c5 100644 --- a/src/osx_app.m +++ b/src/osx_app.m @@ -2616,4 +2616,24 @@ int mp_alert_popup(const char* title, } +//-------------------------------------------------------------------- +// file system stuff... //TODO: move elsewhere +//-------------------------------------------------------------------- + +int mp_file_move(str8 from, str8 to) +{@autoreleasepool{ + NSString* nsFrom = [[NSString alloc] initWithBytes:from.ptr length:from.len encoding: NSUTF8StringEncoding]; + NSString* nsTo = [[NSString alloc] initWithBytes:to.ptr length:to.len encoding: NSUTF8StringEncoding]; + NSError* err; + if([[NSFileManager defaultManager] moveItemAtPath:nsFrom toPath:nsTo error:&err] == YES) + { + return(0); + } + else + { + return(-1); + } +}} + + #undef LOG_SUBSYSTEM