Search
lxdream.org :: lxdream/src/paths.c
lxdream 0.9.1
released Jun 29
Download Now
filename src/paths.c
changeset 866:86cd01c2b2d3
author nkeynes
date Wed Oct 29 23:51:58 2008 +0000 (12 years ago)
permissions -rw-r--r--
last change Use regparam calling conventions for all functions called from translated code,
along with a few other high-use functions. Can probably extend this to all functions,
but as it is this is a nice performance boost
view annotate diff log raw
     1 /**
     2  * $Id: cocoaui.c 863 2008-09-06 05:21:57Z nkeynes $
     3  *
     4  * Wrappers for system-dependent functions (mainly path differences)
     5  *
     6  * Copyright (c) 2008 Nathan Keynes.
     7  *
     8  * This program is free software; you can redistribute it and/or modify
     9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  */
    19 #include <string.h>
    21 #include "lxdream.h"
    23 /* Bundle builds need to use different paths from ordinary builds, since
    24  * the message catalogs, default config, etc are all bundle-relative.
    25  * Otherwise paths use the standard unix install paths
    26  */
    27 #ifdef OSX_BUNDLE
    29 #include <AppKit/AppKit.h>
    31 static char *bundle_resource_path = NULL;
    33 static char *get_bundle_resource_path()
    34 {
    35     if( bundle_resource_path == NULL ) {
    36         NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    37         NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
    38         bundle_resource_path = strdup([resourcePath UTF8String]);
    39         [pool release];
    40     }
    41     return bundle_resource_path;    
    42 }
    44 const char *get_sysconf_path()
    45 {
    46     return get_bundle_resource_path();
    47 }
    49 const char *get_locale_path()
    50 {
    51     return get_bundle_resource_path();
    52 }
    54 #else
    56 const char *get_sysconf_path()
    57 {
    58     return PACKAGE_CONF_DIR;
    59 }
    61 const char *get_locale_path()
    62 {
    63     return PACKAGE_LOCALE_DIR;
    64 }
    66 #endif
.