//
//  TeXDistributionUtils.h
//  TeXDist
//
//  Created by coder on 08/12/06.
//  Copyright 2006 Laurens'Tribune. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "TeXDistSystemVersion.h"

@interface NSURL(TeXDistUtils)
- (NSString *) programsPath4TeXDist;
@end

@interface TeXDistUtils: NSObject
+ (NSString *)texdistExtension;
+ (NSString *)contentsRelativePath;
+ (NSString *)programsRelativePath;
+ (NSString *)texbinRelativePath;
+ (NSString *)rootRelativePath;
+ (NSString *)activeDistributionPath;
+ (NSString *)activeDistributionContentsPath;
+ (NSString *)activeDistributionProgramsPath;
+ (NSString *)activeDistributionProgramsPath_texbin;
+ (NSArray *) expectedPrograms;
+ (NSArray *) CPUNames;
+ (BOOL)isAlternateKeyDown;
+ (NSURL *)distributionsURL;
// This function repairs the texbin link, provided the default distribution is properly setup
// the return value is 0 on success
// a non nul value is returned in case of error
+ (NSString *) path_texbin;
+ (NSBundle *)bundle;
+ (NSDictionary *)minimumSystemVersionsByArch;
+ (NSDictionary *)maximumSystemVersionsByArch;
+ (NSDictionary *)architecturePriorityByArch;
@end

#define IL8N(MSG) NSLocalizedStringFromTableInBundle((MSG), nil, [NSBundle bundleForClass:[TeXDistUtils class]], @"None")

#   define TeXDist_RETURN_ERROR(CODE,MESSAGE)\
    do {\
        if (RORef AND NOT *RORef) {\
            *RORef = [NSError errorWithDomain:TeXDistDomain code:CODE userInfo:[NSDictionary dictionaryWithObject:(IL8N(MESSAGE)) forKey:NSLocalizedDescriptionKey]];\
        } else {\
            TeXDistLog(TeXDistLogLevelAlways,@"TeXDist ERROR(%i): %@",CODE,IL8N(MESSAGE));\
        }\
    } while (NO)

