mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Introduce OakMoveToTrash and make it accessible only to C++
This is just a C++ wrapper around the Cocoa API for moving a file to trash.
This commit is contained in:
committed by
Allan Odgaard
parent
b8143a626c
commit
b9665fa44e
@@ -1,4 +1,15 @@
|
||||
#ifndef OAKFOUNDATION_H_816ED92F
|
||||
#define OAKFOUNDATION_H_816ED92F
|
||||
|
||||
#import <oak/misc.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
PUBLIC std::string OakMoveToTrash (std::string const& path);
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
PUBLIC BOOL OakIsEmptyString (NSString* str);
|
||||
PUBLIC BOOL OakNotEmptyString (NSString* str);
|
||||
#endif
|
||||
|
||||
#endif /* end of include guard: OAKFOUNDATION_H_816ED92F */
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
#import "OakFoundation.h"
|
||||
#import "NSString Additions.h"
|
||||
#import <ns/ns.h>
|
||||
|
||||
std::string OakMoveToTrash (std::string const& path)
|
||||
{
|
||||
NSURL* resultingItemURL;
|
||||
if([[NSFileManager defaultManager] trashItemAtURL:[NSURL fileURLWithPath:[NSString stringWithCxxString:path]] resultingItemURL:&resultingItemURL error:nil])
|
||||
return to_s([resultingItemURL path]);
|
||||
else return NULL_STR;
|
||||
}
|
||||
|
||||
BOOL OakIsEmptyString (NSString* str)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user