src/unix.cpp
branchnoai
changeset 9723 eee46cb39750
parent 9722 ebf0ece7d8f6
child 9724 b39bc69bb2f2
equal deleted inserted replaced
9722:ebf0ece7d8f6 9723:eee46cb39750
     2 
     2 
     3 /** @file unix.cpp */
     3 /** @file unix.cpp */
     4 
     4 
     5 #include "stdafx.h"
     5 #include "stdafx.h"
     6 #include "openttd.h"
     6 #include "openttd.h"
     7 #include "functions.h"
       
     8 #include "window.h"
       
     9 #include "string.h"
       
    10 #include "table/strings.h"
     7 #include "table/strings.h"
    11 #include "variables.h"
     8 #include "variables.h"
       
     9 #include "textbuf_gui.h"
       
    10 #include "functions.h"
       
    11 #include "core/random_func.hpp"
    12 
    12 
    13 #include <dirent.h>
    13 #include <dirent.h>
    14 #include <unistd.h>
    14 #include <unistd.h>
    15 #include <sys/stat.h>
    15 #include <sys/stat.h>
    16 #include <time.h>
    16 #include <time.h>
    65 bool FiosGetDiskFreeSpace(const char *path, uint32 *tot)
    65 bool FiosGetDiskFreeSpace(const char *path, uint32 *tot)
    66 {
    66 {
    67 	uint32 free = 0;
    67 	uint32 free = 0;
    68 
    68 
    69 #ifdef HAS_STATVFS
    69 #ifdef HAS_STATVFS
       
    70 # ifdef __APPLE__
       
    71 	/* OSX 10.3 lacks statvfs so don't try to use it even though later versions of OSX has it. */
       
    72 	if (MacOSVersionIsAtLeast(10, 4, 0))
       
    73 # endif
    70 	{
    74 	{
    71 		struct statvfs s;
    75 		struct statvfs s;
    72 
    76 
    73 		if (statvfs(path, &s) != 0) return false;
    77 		if (statvfs(path, &s) != 0) return false;
    74 		free = (uint64)s.f_frsize * s.f_bavail >> 20;
    78 		free = (uint64)s.f_frsize * s.f_bavail >> 20;
   197 #ifdef WITH_ICONV
   201 #ifdef WITH_ICONV
   198 
   202 
   199 #include <iconv.h>
   203 #include <iconv.h>
   200 #include <errno.h>
   204 #include <errno.h>
   201 #include "debug.h"
   205 #include "debug.h"
       
   206 #include "string_func.h"
   202 
   207 
   203 #define INTERNALCODE "UTF-8"
   208 #define INTERNALCODE "UTF-8"
   204 
   209 
   205 /** Try and try to decipher the current locale from environmental
   210 /** Try and try to decipher the current locale from environmental
   206  * variables. MacOSX is hardcoded, other OS's are dynamic. If no suitable
   211  * variables. MacOSX is hardcoded, other OS's are dynamic. If no suitable