//
//  BXPathUtils.h
//  Boinx Utility Framework
//
//  Created by Florian Albrecht on 10.12.04.
//  Copyright 2004 GeBE Computer & Peripherie GmbH. All rights reserved.
//


@interface BXPathUtils : NSObject {

}

+ (NSString*) utiForPath: (NSString *) path;
+ (NSString*) utiForExtension:(NSString *)inExtension;

+ (NSNumber*) getFreeSpaceForPath: (NSString *) path;

+ (NSString*) getFreeSpaceString: (NSNumber *) value;

+ (BOOL) testPathForNetwork:(NSString*)thePath;

/*!
    @method     canWriteToPath:withFreeSpace:error:
    @abstract   checks whether path contains enough free space and is writable. returns YES is everything is ok, NO otherwise. in case of NO it returns also an appropriate error
    @discussion this method checks whether the path exists, is a directory, is writable by the current process and, if amounInMegaBytes is greater than 0, checks whether at least amountOfMegaBytes free space is left at the path
    @param      path the path that should be written to
    @param      amountInMegaBytes number of megabytes that need to be available at path, set to nil or 0 if you don't want to check
    @param      ioError error that gets returned when result is NO, do not provide error on cal
    @result     NO if any condition fails, YES if everything is fine
*/
+ (BOOL) canWriteToPath:(NSString *)path withFreeSpace:(NSNumber *)amountInMegaBytes error:(NSError **)ioError;

// Path Helpers
+ (BOOL) fileExists:(NSString *)inPath;
+ (BOOL) isAbsolutePath:(NSString *)inPath;
+ (BOOL) isRelativePath:(NSString *)inPath;

+ (NSString*) absolutePathWithBasePath:(NSString *)inBasePath relativePath:(NSString *)inRelativePath;
+ (NSString*) relativePathWithBasePath:(NSString *)inBasePath absolutePath:(NSString *)inAbsolutePath;

+ (NSString*) resolvedPath:(NSString *)inAbsolutePath;
+ (NSString*) resolveLeafAlias:(NSString *)inAbsolutePath;

+ (FSVolumeRefNum) volumeForPath:(NSString *)inAbsolutePath;
+ (NSString*) tempFolderForPath:(NSString *)inAbsolutePath;

#if !__LP64__
+ (FSSpec) getFSSpecFromAbsolutePath:(NSString *)inAbsolutePath error:(NSError **)outError;
#endif

+ (NSNumber*) fileSizeAtPath:(NSString *)inPath;
+ (NSNumber*) freeDiskBytesForFolder:(NSString *)inPath;
+ (NSString*) sizeStringFromBytes:(double)inBytes;

@end
