diff --git a/libs/kiplatform/osx/environment.mm b/libs/kiplatform/osx/environment.mm index 4e0913a53e..440b8b088c 100644 --- a/libs/kiplatform/osx/environment.mm +++ b/libs/kiplatform/osx/environment.mm @@ -22,13 +22,12 @@ #import #include - +#include bool KIPLATFORM::ENV::MoveToTrash( const wxString& aPath, wxString& aError ) { - wxString temp = "file:///" + aPath; - - NSURL* url = [NSURL URLWithString:wxCFStringRef( temp ).AsNSString()]; + bool isDirectory = wxDirExists( aPath ); + NSURL* url = [NSURL fileURLWithPath:wxCFStringRef( aPath ).AsNSString() isDirectory:isDirectory]; NSError* err = NULL; BOOL result = [[NSFileManager defaultManager] trashItemAtURL:url resultingItemURL:nil error:&err];