Fix crash bug when deleting files with spaces in names.
This commit is contained in:
parent
f35736cdd7
commit
a3a409b438
|
@ -22,13 +22,12 @@
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#include <wx/osx/core/cfstring.h>
|
#include <wx/osx/core/cfstring.h>
|
||||||
|
#include <wx/filefn.h>
|
||||||
|
|
||||||
bool KIPLATFORM::ENV::MoveToTrash( const wxString& aPath, wxString& aError )
|
bool KIPLATFORM::ENV::MoveToTrash( const wxString& aPath, wxString& aError )
|
||||||
{
|
{
|
||||||
wxString temp = "file:///" + aPath;
|
bool isDirectory = wxDirExists( aPath );
|
||||||
|
NSURL* url = [NSURL fileURLWithPath:wxCFStringRef( aPath ).AsNSString() isDirectory:isDirectory];
|
||||||
NSURL* url = [NSURL URLWithString:wxCFStringRef( temp ).AsNSString()];
|
|
||||||
NSError* err = NULL;
|
NSError* err = NULL;
|
||||||
|
|
||||||
BOOL result = [[NSFileManager defaultManager] trashItemAtURL:url resultingItemURL:nil error:&err];
|
BOOL result = [[NSFileManager defaultManager] trashItemAtURL:url resultingItemURL:nil error:&err];
|
||||||
|
|
Loading…
Reference in New Issue