view dstep/foundation/NSFileManager.d @ 16:19885b43130e

Huge update, the bridge actually works now
author Jacob Carlborg <doob@me.com>
date Sun, 03 Jan 2010 22:06:11 +0100
parents 7ff919f595d5
children b9de51448c6b
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Aug 3, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.foundation.NSFileManager;

import dstep.corefoundation.CFBase;
import dstep.foundation.NSArray;
import dstep.foundation.NSData;
import dstep.foundation.NSDate;
import dstep.foundation.NSDictionary;
import dstep.foundation.NSEnumerator;
import dstep.foundation.NSError;
import dstep.foundation.NSObjCRuntime;
import dstep.foundation.NSObject;
import dstep.foundation.NSString;
import dstep.foundation.NSValue;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;

import bindings = dstep.foundation.NSFileManager_bindings;

private
{
	NSString NSFileType_;
	NSString NSFileTypeDirectory_;
	NSString NSFileTypeRegular_;
	NSString NSFileTypeSymbolicLink_;
	NSString NSFileTypeSocket_;
	NSString NSFileTypeCharacterSpecial_;
	NSString NSFileTypeBlockSpecial_;
	NSString NSFileTypeUnknown_;
	NSString NSFileSize_;
	NSString NSFileModificationDate_;
	NSString NSFileReferenceCount_;
	NSString NSFileDeviceIdentifier_;
	NSString NSFileOwnerAccountName_;
	NSString NSFileGroupOwnerAccountName_;
	NSString NSFilePosixPermissions_;
	NSString NSFileSystemNumber_;
	NSString NSFileSystemFileNumber_;
	NSString NSFileExtensionHidden_;
	NSString NSFileHFSCreatorCode_;
	NSString NSFileHFSTypeCode_;
	NSString NSFileImmutable_;
	NSString NSFileAppendOnly_;
	NSString NSFileCreationDate_;
	NSString NSFileOwnerAccountID_;
	NSString NSFileGroupOwnerAccountID_;
	NSString NSFileBusy_;
	NSString NSFileSystemSize_;
	NSString NSFileSystemFreeSize_;
	NSString NSFileSystemNodes_;
	NSString NSFileSystemFreeNodes_;
}

NSString NSFileType ()
{
	if (NSFileType_)
		return NSFileType_;
		
	return NSFileType_ = new NSString(bindings.NSFileType);
}

NSString NSFileTypeDirectory ()
{
	if (NSFileTypeDirectory_)
		return NSFileTypeDirectory_;
		
	return NSFileTypeDirectory_ = new NSString(bindings.NSFileTypeDirectory);
}

NSString NSFileTypeRegular ()
{
	if (NSFileTypeRegular_)
		return NSFileTypeRegular_;
		
	return NSFileTypeRegular_ = new NSString(bindings.NSFileTypeRegular);
}

NSString NSFileTypeSymbolicLink ()
{
	if (NSFileTypeSymbolicLink_)
		return NSFileTypeSymbolicLink_;
		
	return NSFileTypeSymbolicLink_ = new NSString(bindings.NSFileTypeSymbolicLink);
}

NSString NSFileTypeSocket ()
{
	if (NSFileTypeSocket_)
		return NSFileTypeSocket_;
		
	return NSFileTypeSocket_ = new NSString(bindings.NSFileTypeSocket);
}

NSString NSFileTypeCharacterSpecial ()
{
	if (NSFileTypeCharacterSpecial_)
		return NSFileTypeCharacterSpecial_;
		
	return NSFileTypeCharacterSpecial_ = new NSString(bindings.NSFileTypeCharacterSpecial);
}

NSString NSFileTypeBlockSpecial ()
{
	if (NSFileTypeBlockSpecial_)
		return NSFileTypeBlockSpecial_;
		
	return NSFileTypeBlockSpecial_ = new NSString(bindings.NSFileTypeBlockSpecial);
}

NSString NSFileTypeUnknown ()
{
	if (NSFileTypeUnknown_)
		return NSFileTypeUnknown_;
		
	return NSFileTypeUnknown_ = new NSString(bindings.NSFileTypeUnknown);
}

NSString NSFileSize ()
{
	if (NSFileSize_)
		return NSFileSize_;
		
	return NSFileSize_ = new NSString(bindings.NSFileSize);
}

NSString NSFileModificationDate ()
{
	if (NSFileModificationDate_)
		return NSFileModificationDate_;
		
	return NSFileModificationDate_ = new NSString(bindings.NSFileModificationDate);
}

NSString NSFileReferenceCount ()
{
	if (NSFileReferenceCount_)
		return NSFileReferenceCount_;
		
	return NSFileReferenceCount_ = new NSString(bindings.NSFileReferenceCount);
}

NSString NSFileDeviceIdentifier ()
{
	if (NSFileDeviceIdentifier_)
		return NSFileDeviceIdentifier_;
		
	return NSFileDeviceIdentifier_ = new NSString(bindings.NSFileDeviceIdentifier);
}

NSString NSFileOwnerAccountName ()
{
	if (NSFileOwnerAccountName_)
		return NSFileOwnerAccountName_;
		
	return NSFileOwnerAccountName_ = new NSString(bindings.NSFileOwnerAccountName);
}

NSString NSFileGroupOwnerAccountName ()
{
	if (NSFileGroupOwnerAccountName_)
		return NSFileGroupOwnerAccountName_;
		
	return NSFileGroupOwnerAccountName_ = new NSString(bindings.NSFileGroupOwnerAccountName);
}

NSString NSFilePosixPermissions ()
{
	if (NSFilePosixPermissions_)
		return NSFilePosixPermissions_;
		
	return NSFilePosixPermissions_ = new NSString(bindings.NSFilePosixPermissions);
}

NSString NSFileSystemNumber ()
{
	if (NSFileSystemNumber_)
		return NSFileSystemNumber_;
		
	return NSFileSystemNumber_ = new NSString(bindings.NSFileSystemNumber);
}

NSString NSFileSystemFileNumber ()
{
	if (NSFileSystemFileNumber_)
		return NSFileSystemFileNumber_;
		
	return NSFileSystemFileNumber_ = new NSString(bindings.NSFileSystemFileNumber);
}

NSString NSFileExtensionHidden ()
{
	if (NSFileExtensionHidden_)
		return NSFileExtensionHidden_;
		
	return NSFileExtensionHidden_ = new NSString(bindings.NSFileExtensionHidden);
}

NSString NSFileHFSCreatorCode ()
{
	if (NSFileHFSCreatorCode_)
		return NSFileHFSCreatorCode_;
		
	return NSFileHFSCreatorCode_ = new NSString(bindings.NSFileHFSCreatorCode);
}

NSString NSFileHFSTypeCode ()
{
	if (NSFileHFSTypeCode_)
		return NSFileHFSTypeCode_;
		
	return NSFileHFSTypeCode_ = new NSString(bindings.NSFileHFSTypeCode);
}

NSString NSFileImmutable ()
{
	if (NSFileImmutable_)
		return NSFileImmutable_;
		
	return NSFileImmutable_ = new NSString(bindings.NSFileImmutable);
}

NSString NSFileAppendOnly ()
{
	if (NSFileAppendOnly_)
		return NSFileAppendOnly_;
		
	return NSFileAppendOnly_ = new NSString(bindings.NSFileAppendOnly);
}

NSString NSFileCreationDate ()
{
	if (NSFileCreationDate_)
		return NSFileCreationDate_;
		
	return NSFileCreationDate_ = new NSString(bindings.NSFileCreationDate);
}

NSString NSFileOwnerAccountID ()
{
	if (NSFileOwnerAccountID_)
		return NSFileOwnerAccountID_;
		
	return NSFileOwnerAccountID_ = new NSString(bindings.NSFileOwnerAccountID);
}

NSString NSFileGroupOwnerAccountID ()
{
	if (NSFileGroupOwnerAccountID_)
		return NSFileGroupOwnerAccountID_;
		
	return NSFileGroupOwnerAccountID_ = new NSString(bindings.NSFileGroupOwnerAccountID);
}

NSString NSFileBusy ()
{
	if (NSFileBusy_)
		return NSFileBusy_;
		
	return NSFileBusy_ = new NSString(bindings.NSFileBusy);
}

NSString NSFileSystemSize ()
{
	if (NSFileSystemSize_)
		return NSFileSystemSize_;
		
	return NSFileSystemSize_ = new NSString(bindings.NSFileSystemSize);
}

NSString NSFileSystemFreeSize ()
{
	if (NSFileSystemFreeSize_)
		return NSFileSystemFreeSize_;
		
	return NSFileSystemFreeSize_ = new NSString(bindings.NSFileSystemFreeSize);
}

NSString NSFileSystemNodes ()
{
	if (NSFileSystemNodes_)
		return NSFileSystemNodes_;
		
	return NSFileSystemNodes_ = new NSString(bindings.NSFileSystemNodes);
}

NSString NSFileSystemFreeNodes ()
{
	if (NSFileSystemFreeNodes_)
		return NSFileSystemFreeNodes_;
		
	return NSFileSystemFreeNodes_ = new NSString(bindings.NSFileSystemFreeNodes);
}

const TNSFileManagerFileOperationAdditions = `

	bool fileManager (NSFileManager fileManager, NSString srcPath, NSString dstPath)
	{
		return invokeObjcSelf!(bool, "fileManager:shouldCopyItemAtPath:toPath:dstPath:", NSFileManager, NSString, NSString);
	}
	
	bool fileManager (NSFileManager fileManager, NSError error, NSString srcPath, NSString dstPath)
	{
		return invokeObjcSelf!(bool, "fileManager:shouldProceedAfterError:copyingItemAtPath:toPath:", NSFileManager, NSError, NSString, NSString)(fileManager, error, srcPath, dstPath);
	}
	
	bool fileManager (NSFileManager fileManager, NSString srcPath, NSString dstPath)
	{
		return invokeObjcSelf!(bool, "fileManager:shouldMoveItemAtPath:toPath:", NSFileManager, NSString, NSString)(fileManager, srcPath, dstPath);
	}
	
	bool fileManager (NSFileManager fileManager, NSError error, NSString srcPath, NSString dstPath)
	{
		 return invokeObjcSelf!(bool, "fileManager:shouldProceedAfterError:movingItemAtPath:toPath:", NSFileManager, NSError, NSString, NSString)(fileManager, error, srcPath, dstPath);
	}
	
	bool fileManager (NSFileManager fileManager, NSString srcPath, NSString dstPath)
	{
		return invokeObjcSelf!(bool, "fileManager:shouldLinkItemAtPath:toPath:", NSFileManager, NSString, NSString)(fileManager, srcPath, dstPath);
	}
	
	bool fileManager (NSFileManager fileManager, NSError error, NSString srcPath, NSString dstPath)
	{
		return invokeObjcSelf!(bool, "fileManager:shouldProceedAfterError:linkingItemAtPath:toPath", NSFileManager, NSError, NSString, NSString)(fileManager, error, srcPath, dstPath);
	}
	
	bool fileManager (NSFileManager fileManager, NSString path)
	{
		return invokeObjcSelf!(bool, "fileManager:shouldRemoveItemAtPath:", NSFileManager, NSString)(fileManager, path);
	}
	
	bool fileManager (NSFileManager fileManager, NSError error, NSString path)
	{
		return invokeObjcSelf!(bool, "fileManager:shouldProceedAfterError:removingItemAtPath:", NSFileManager, NSError, NSString)(fileManager, error, path);
	}
	
	//mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldCopyItemAtPath:toPath:dstPath:", NSFileManager, NSString, NSString);
	//mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldProceedAfterError:copyingItemAtPath:toPath:", NSFileManager, NSError, NSString, NSString);
	//mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldMoveItemAtPath:toPath:", NSFileManager, NSString, NSString);
	//mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldProceedAfterError:movingItemAtPath:toPath:", NSFileManager, NSError, NSString, NSString);
	//mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldLinkItemAtPath:toPath:", NSFileManager, NSString, NSString);
	//mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldProceedAfterError:linkingItemAtPath:toPath", NSFileManager, NSError, NSString, NSString);
	//mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldRemoveItemAtPath:", NSFileManager, NSString);
	//mixin ObjcBindMethod!(fileManager, bool, "fileManager:shouldProceedAfterError:removingItemAtPath:", NSFileManager, NSError, NSString);
`;

const TNSCopyLinkMoveHandler = `

	bool fileManager (NSFileManager fm, NSDictionary errorInfo)
	{
		return invokeObjcSelf!(bool, "fileManager:shouldProceedAfterError:", NSFileManager, NSDictionary)(fm, errorInfo);
	}
	
	void fileManager (NSFileManager fm, NSString path)
	{
		return invokeObjcSelf!(void, "fileManager:willProcessPath:", NSFileManager, NSString)(fm, path);
	}
	
	//mixin ObjcBindMethod!(fileManager, "fileManager:shouldProceedAfterError:");
	//mixin ObjcBindMethod!(fileManager, "fileManager:willProcessPath:");
`;

const TNSFileAttributes = `

	ulong fileSize ()
	{
		return invokeObjcSelf!(ulong, "fileSize");
	}

	NSDate fileModificationDate ()
	{
		return invokeObjcSelf!(NSDate, "fileModificationDate");
	}

	NSString fileType ()
	{
		return invokeObjcSelf!(NSString, "fileType");
	}

	NSUInteger filePosixPermissions ()
	{
		return invokeObjcSelf!(NSUInteger, "filePosixPermissions");
	}

	NSString fileOwnerAccountName ()
	{
		return invokeObjcSelf!(NSString, "fileOwnerAccountName");
	}

	NSString fileGroupOwnerAccountName ()
	{
		return invokeObjcSelf!(NSString, "fileGroupOwnerAccountName");
	}

	NSInteger fileSystemNumber ()
	{
		return invokeObjcSelf!(NSInteger, "fileSystemNumber");
	}

	NSUInteger fileSystemFileNumber ()
	{
		return invokeObjcSelf!(NSUInteger, "fileSystemFileNumber");
	}

	bool fileExtensionHidden ()
	{
		return invokeObjcSelf!(bool, "fileExtensionHidden");
	}

	uint fileHFSCreatorCode ()
	{
		return invokeObjcSelf!(uint, "fileHFSCreatorCode");
	}

	uint fileHFSTypeCode ()
	{
		return invokeObjcSelf!(uint, "fileHFSTypeCode");
	}

	bool fileIsImmutable ()
	{
		return invokeObjcSelf!(bool, "fileIsImmutable");
	}

	bool fileIsAppendOnly ()
	{
		return invokeObjcSelf!(bool, "fileIsAppendOnly");
	}

	NSDate fileCreationDate ()
	{
		return invokeObjcSelf!(NSDate, "fileCreationDate");
	}

	NSNumber fileOwnerAccountID ()
	{
		return invokeObjcSelf!(NSNumber, "fileOwnerAccountID");
	}

	NSNumber fileGroupOwnerAccountID ()
	{
		return invokeObjcSelf!(NSNumber, "fileGroupOwnerAccountID");
	}
`;

class NSFileManager : NSObject
{
	mixin (ObjcWrap);
	
	this ()
	{
		super(typeof(this).alloc.init.objcObject);
	}
	
	typeof(this) init ()
	{
		return invokeObjcSelf!(typeof(this), "init");
	}

	static NSFileManager defaultManager ()
	{
		return invokeObjcSuperClass!(NSFileManager, "defaultManager");
	}

	void setDelegate (Object delegate_)
	{
		return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_);
	}

	Object delegate_ ()
	{
		return invokeObjcSelf!(Object, "delegate");
	}

	bool setAttributes (NSDictionary attributes, NSString path, ref NSError error)
	{
		id err;
		
		if (error)
			err = new objc_object;
		
		bool result = invokeObjcSelf!(bool, "setAttributes:ofItemAtPath:error:", NSDictionary, NSString, id*)(attributes, path, &err);
		
		if (err)
			error = new NSError(err);
		
		return result;
	}

	bool createDirectoryAtPath (NSString path, bool createIntermediates, NSDictionary attributes, ref NSError error)
	{
		id err;
		
		if (error)
			err = new objc_object;
		
		bool result = invokeObjcSelf!(bool, "createDirectoryAtPath:withIntermediateDirectories:attributes:error:", NSString, bool, NSDictionary, id*)(path, createIntermediates, attributes, &err);
		
		if (err)
			error = new NSError(err);
		
		return result;
	}

	NSArray contentsOfDirectoryAtPath (NSString path, ref NSError error)
	{
		id err;
		
		if (error)
			err = new objc_object;
		
		NSArray result = invokeObjcSelf!(NSArray, "contentsOfDirectoryAtPath:error:", NSString, id*)(path, &err);
		
		if (err)
			error = new NSError(err);
		
		return result;
	}

	NSArray subpathsOfDirectoryAtPath (NSString path, ref NSError error)
	{
		id err;
		
		if (error)
			err = new objc_object;
		
		NSArray result = invokeObjcSelf!(NSArray, "subpathsOfDirectoryAtPath:error:", NSString, id*)(path, &err);
		
		if (err)
			error = new NSError(err);
		
		return result;
	}

	NSDictionary attributesOfItemAtPath (NSString path, ref NSError error)
	{
		id err;
		
		if (error)
			err = new objc_object;
		
		NSDictionary result = invokeObjcSelf!(NSDictionary, "attributesOfItemAtPath:error:", NSString, id*)(path, &err);
		
		if (err)
			error = new NSError(err);
		
		return result;
	}

	NSDictionary attributesOfFileSystemForPath (NSString path, ref NSError error)
	{
		id err;
		
		if (error)
			err = new objc_object;
		
		NSDictionary result = invokeObjcSelf!(NSDictionary, "attributesOfFileSystemForPath:error:", NSString, id*)(path, &err);
		
		if (err)
			error = new NSError(err);
		
		return result;
	}

	bool createSymbolicLinkAtPath (NSString path, NSString destPath, ref NSError error)
	{
		id err;
		
		if (error)
			err = new objc_object;
		
		bool result = invokeObjcSelf!(bool, "createSymbolicLinkAtPath:withDestinationPath:error:", NSString, NSString, id*)(path, destPath, &err);
		
		if (err)
			error = new NSError(err);
		
		return result;
	}

	NSString destinationOfSymbolicLinkAtPath (NSString path, ref NSError error)
	{
		id err;
		
		if (error)
			err = new objc_object;
		
		NSString result = invokeObjcSelf!(NSString, "destinationOfSymbolicLinkAtPath:error:", NSString, id*)(path, &err);
		
		if (err)
			error = new NSError(err);
		
		return result;
	}

	bool copyItemAtPath (NSString srcPath, NSString dstPath, ref NSError error)
	{
		id err;
		
		if (error)
			err = new objc_object;
		
		bool result = invokeObjcSelf!(bool, "copyItemAtPath:toPath:error:", NSString, NSString, id*)(srcPath, dstPath, &err);
		
		if (err)
			error = new NSError(err);
		
		return result;
	}

	bool moveItemAtPath (NSString srcPath, NSString dstPath, ref NSError error)
	{
		id err;
		
		if (error)
			err = new objc_object;
		
		bool result = invokeObjcSelf!(bool, "moveItemAtPath:toPath:error:", NSString, NSString, id*)(srcPath, dstPath, &err);
		
		if (err)
			error = new NSError(err);
		
		return result;
	}

	bool linkItemAtPath (NSString srcPath, NSString dstPath, ref NSError error)
	{
		id err;
		
		if (error)
			err = new objc_object;
		
		bool result = invokeObjcSelf!(bool, "linkItemAtPath:toPath:error:", NSString, NSString, id*)(srcPath, dstPath, &err);
		
		if (err)
			error = new NSError(err);
		
		return result;
	}

	bool removeItemAtPath (NSString path, ref NSError error)
	{
		id err;
		
		if (error)
			err = new objc_object;
		
		bool result = invokeObjcSelf!(bool, "removeItemAtPath:error:", NSString, id*)(path, &err);
		
		if (err)
			error = new NSError(err);
		
		return result;
	}

	NSDictionary fileAttributesAtPath (NSString path, bool yorn)
	{
		return invokeObjcSelf!(NSDictionary, "fileAttributesAtPath:traverseLink:", NSString, bool)(path, yorn);
	}

	bool changeFileAttributes (NSDictionary attributes, NSString path)
	{
		return invokeObjcSelf!(bool, "changeFileAttributes:atPath:", NSDictionary, NSString)(attributes, path);
	}

	NSArray directoryContentsAtPath (NSString path)
	{
		return invokeObjcSelf!(NSArray, "directoryContentsAtPath:", NSString)(path);
	}

	NSDictionary fileSystemAttributesAtPath (NSString path)
	{
		return invokeObjcSelf!(NSDictionary, "fileSystemAttributesAtPath:", NSString)(path);
	}

	NSString pathContentOfSymbolicLinkAtPath (NSString path)
	{
		return invokeObjcSelf!(NSString, "pathContentOfSymbolicLinkAtPath:", NSString)(path);
	}

	bool createSymbolicLinkAtPath (NSString path, NSString otherpath)
	{
		return invokeObjcSelf!(bool, "createSymbolicLinkAtPath:pathContent:", NSString, NSString)(path, otherpath);
	}

	bool createDirectoryAtPath (NSString path, NSDictionary attributes)
	{
		return invokeObjcSelf!(bool, "createDirectoryAtPath:attributes:", NSString, NSDictionary)(path, attributes);
	}

	bool linkPath (NSString src, NSString dest, Object handler)
	{
		return invokeObjcSelf!(bool, "linkPath:toPath:handler:", NSString, NSString, Object)(src, dest, handler);
	}

	bool copyPath (NSString src, NSString dest, Object handler)
	{
		return invokeObjcSelf!(bool, "copyPath:toPath:handler:", NSString, NSString, Object)(src, dest, handler);
	}

	bool movePath (NSString src, NSString dest, Object handler)
	{
		return invokeObjcSelf!(bool, "movePath:toPath:handler:", NSString, NSString, Object)(src, dest, handler);
	}

	bool removeFileAtPath (NSString path, Object handler)
	{
		return invokeObjcSelf!(bool, "removeFileAtPath:handler:", NSString, Object)(path, handler);
	}

	NSString currentDirectoryPath ()
	{
		return invokeObjcSelf!(NSString, "currentDirectoryPath");
	}

	bool changeCurrentDirectoryPath (NSString path)
	{
		return invokeObjcSelf!(bool, "changeCurrentDirectoryPath:", NSString)(path);
	}

	bool fileExistsAtPath (NSString path)
	{
		return invokeObjcSelf!(bool, "fileExistsAtPath:", NSString)(path);
	}

	bool fileExistsAtPath (NSString path, out bool isDirectory)
	{
		return invokeObjcSelf!(bool, "fileExistsAtPath:isDirectory:", NSString, bool*)(path, &isDirectory);
	}

	bool isReadableFileAtPath (NSString path)
	{
		return invokeObjcSelf!(bool, "isReadableFileAtPath:", NSString)(path);
	}

	bool isWritableFileAtPath (NSString path)
	{
		return invokeObjcSelf!(bool, "isWritableFileAtPath:", NSString)(path);
	}

	bool isExecutableFileAtPath (NSString path)
	{
		return invokeObjcSelf!(bool, "isExecutableFileAtPath:", NSString)(path);
	}

	bool isDeletableFileAtPath (NSString path)
	{
		return invokeObjcSelf!(bool, "isDeletableFileAtPath:", NSString)(path);
	}

	bool contentsEqualAtPath (NSString path1, NSString path2)
	{
		return invokeObjcSelf!(bool, "contentsEqualAtPath:andPath:", NSString, NSString)(path1, path2);
	}

	NSString displayNameAtPath (NSString path)
	{
		return invokeObjcSelf!(NSString, "displayNameAtPath:", NSString)(path);
	}

	NSArray componentsToDisplayForPath (NSString path)
	{
		return invokeObjcSelf!(NSArray, "componentsToDisplayForPath:", NSString)(path);
	}

	NSDirectoryEnumerator enumeratorAtPath (NSString path)
	{
		return invokeObjcSelf!(NSDirectoryEnumerator, "enumeratorAtPath:", NSString)(path);
	}

	NSArray subpathsAtPath (NSString path)
	{
		return invokeObjcSelf!(NSArray, "subpathsAtPath:", NSString)(path);
	}

	NSData contentsAtPath (NSString path)
	{
		return invokeObjcSelf!(NSData, "contentsAtPath:", NSString)(path);
	}

	bool createFileAtPath (NSString path, NSData data, NSDictionary attr)
	{
		return invokeObjcSelf!(bool, "createFileAtPath:contents:attributes:", NSString, NSData, NSDictionary)(path, data, attr);
	}

	char* fileSystemRepresentationWithPath (NSString path)
	{
		return invokeObjcSelf!(char*, "fileSystemRepresentationWithPath:", NSString)(path);
	}

	NSString stringWithFileSystemRepresentation (char* str, NSUInteger len)
	{
		return invokeObjcSelf!(NSString, "stringWithFileSystemRepresentation:length:", char*, NSUInteger)(str, len);
	}
}

class NSDirectoryEnumerator : NSEnumerator
{
	mixin (ObjcWrap);
	
	this ()
	{
		super(typeof(this).alloc.init.objcObject);
	}
	
	typeof(this) init ()
	{
		return invokeObjcSelf!(typeof(this), "init");
	}

	NSDictionary fileAttributes ()
	{
		return invokeObjcSelf!(NSDictionary, "fileAttributes");
	}

	NSDictionary directoryAttributes ()
	{
		return invokeObjcSelf!(NSDictionary, "directoryAttributes");
	}

	void skipDescendents ()
	{
		return invokeObjcSelf!(void, "skipDescendents");
	}
}