author | truelight |
Mon, 19 Mar 2007 12:30:11 +0000 | |
branch | noai |
changeset 9475 | 58c20c0e394f |
parent 6625 | 3348b52bd823 |
child 6643 | 7fad81bde617 |
child 9476 | 1d1ed96f32ad |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6527
f584ab6d87f8
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6505
diff
changeset
|
3 |
/** @file fileio.cpp Standard In/Out file operations */ |
6505
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6218
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1198
diff
changeset
|
6 |
#include "openttd.h" |
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1039
diff
changeset
|
7 |
#include "fileio.h" |
2163
637ec3c361f5
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
8 |
#include "functions.h" |
4200
a45420ba0c23
(svn r5684) - Codechange: create an strtolower() function that uses tolower() on a whole string and apply it in the places this was used.
Darkvater
parents:
4077
diff
changeset
|
9 |
#include "string.h" |
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2153
diff
changeset
|
10 |
#include "macros.h" |
2153
91e89aa8c299
(svn r2663) Include variables.h only in these files which need it, not globally via openttd.h
tron
parents:
1891
diff
changeset
|
11 |
#include "variables.h" |
6218
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
12 |
#include "debug.h" |
6624
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
13 |
#include "fios.h" |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
14 |
#ifndef WIN32 |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
15 |
#include <sys/stat.h> |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
16 |
#endif |
0 | 17 |
|
18 |
/*************************************************/ |
|
19 |
/* FILE IO ROUTINES ******************************/ |
|
20 |
/*************************************************/ |
|
21 |
||
22 |
#define FIO_BUFFER_SIZE 512 |
|
6218
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
23 |
#define MAX_HANDLES 64 |
0 | 24 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
25 |
struct Fio { |
4203
790879e123dd
(svn r5687) - Cleanup: Some cleanup and commentarizing.
Darkvater
parents:
4202
diff
changeset
|
26 |
byte *buffer, *buffer_end; ///< position pointer in local buffer and last valid byte of buffer |
790879e123dd
(svn r5687) - Cleanup: Some cleanup and commentarizing.
Darkvater
parents:
4202
diff
changeset
|
27 |
uint32 pos; ///< current (system) position in file |
790879e123dd
(svn r5687) - Cleanup: Some cleanup and commentarizing.
Darkvater
parents:
4202
diff
changeset
|
28 |
FILE *cur_fh; ///< current file handle |
6218
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
29 |
FILE *handles[MAX_HANDLES]; ///< array of file handles we can have open |
4203
790879e123dd
(svn r5687) - Cleanup: Some cleanup and commentarizing.
Darkvater
parents:
4202
diff
changeset
|
30 |
byte buffer_start[FIO_BUFFER_SIZE]; ///< local buffer when read from file |
6218
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
31 |
#if defined(LIMITED_FDS) |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
32 |
uint open_handles; ///< current amount of open handles |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
33 |
const char *filename[MAX_HANDLES]; ///< array of filenames we (should) have open |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
34 |
uint usage_count[MAX_HANDLES]; ///< count how many times this file has been opened |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
35 |
#endif /* LIMITED_FDS */ |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
36 |
}; |
0 | 37 |
|
38 |
static Fio _fio; |
|
39 |
||
6505
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6218
diff
changeset
|
40 |
/* Get current position in file */ |
6573 | 41 |
uint32 FioGetPos() |
0 | 42 |
{ |
43 |
return _fio.pos + (_fio.buffer - _fio.buffer_start) - FIO_BUFFER_SIZE; |
|
44 |
} |
|
45 |
||
46 |
void FioSeekTo(uint32 pos, int mode) |
|
47 |
{ |
|
48 |
if (mode == SEEK_CUR) pos += FioGetPos(); |
|
49 |
_fio.buffer = _fio.buffer_end = _fio.buffer_start + FIO_BUFFER_SIZE; |
|
4203
790879e123dd
(svn r5687) - Cleanup: Some cleanup and commentarizing.
Darkvater
parents:
4202
diff
changeset
|
50 |
_fio.pos = pos; |
790879e123dd
(svn r5687) - Cleanup: Some cleanup and commentarizing.
Darkvater
parents:
4202
diff
changeset
|
51 |
fseek(_fio.cur_fh, _fio.pos, SEEK_SET); |
0 | 52 |
} |
53 |
||
6218
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
54 |
#if defined(LIMITED_FDS) |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
55 |
static void FioRestoreFile(int slot) |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
56 |
{ |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
57 |
/* Do we still have the file open, or should we reopen it? */ |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
58 |
if (_fio.handles[slot] == NULL) { |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
59 |
DEBUG(misc, 6, "Restoring file '%s' in slot '%d' from disk", _fio.filename[slot], slot); |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
60 |
FioOpenFile(slot, _fio.filename[slot]); |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
61 |
} |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
62 |
_fio.usage_count[slot]++; |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
63 |
} |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
64 |
#endif /* LIMITED_FDS */ |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
65 |
|
6505
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6218
diff
changeset
|
66 |
/* Seek to a file and a position */ |
0 | 67 |
void FioSeekToFile(uint32 pos) |
68 |
{ |
|
6218
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
69 |
FILE *f; |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
70 |
#if defined(LIMITED_FDS) |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
71 |
/* Make sure we have this file open */ |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
72 |
FioRestoreFile(pos >> 24); |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
73 |
#endif /* LIMITED_FDS */ |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
74 |
f = _fio.handles[pos >> 24]; |
0 | 75 |
assert(f != NULL); |
76 |
_fio.cur_fh = f; |
|
4203
790879e123dd
(svn r5687) - Cleanup: Some cleanup and commentarizing.
Darkvater
parents:
4202
diff
changeset
|
77 |
FioSeekTo(GB(pos, 0, 24), SEEK_SET); |
0 | 78 |
} |
79 |
||
6573 | 80 |
byte FioReadByte() |
0 | 81 |
{ |
82 |
if (_fio.buffer == _fio.buffer_end) { |
|
83 |
_fio.pos += FIO_BUFFER_SIZE; |
|
84 |
fread(_fio.buffer = _fio.buffer_start, 1, FIO_BUFFER_SIZE, _fio.cur_fh); |
|
85 |
} |
|
86 |
return *_fio.buffer++; |
|
87 |
} |
|
88 |
||
89 |
void FioSkipBytes(int n) |
|
90 |
{ |
|
2952 | 91 |
for (;;) { |
0 | 92 |
int m = min(_fio.buffer_end - _fio.buffer, n); |
93 |
_fio.buffer += m; |
|
94 |
n -= m; |
|
95 |
if (n == 0) break; |
|
96 |
FioReadByte(); |
|
97 |
n--; |
|
98 |
} |
|
99 |
} |
|
100 |
||
6573 | 101 |
uint16 FioReadWord() |
0 | 102 |
{ |
103 |
byte b = FioReadByte(); |
|
104 |
return (FioReadByte() << 8) | b; |
|
105 |
} |
|
106 |
||
6573 | 107 |
uint32 FioReadDword() |
0 | 108 |
{ |
109 |
uint b = FioReadWord(); |
|
110 |
return (FioReadWord() << 16) | b; |
|
111 |
} |
|
112 |
||
113 |
void FioReadBlock(void *ptr, uint size) |
|
114 |
{ |
|
115 |
FioSeekTo(FioGetPos(), SEEK_SET); |
|
116 |
_fio.pos += size; |
|
117 |
fread(ptr, 1, size, _fio.cur_fh); |
|
118 |
} |
|
119 |
||
1039
8736f759759b
(svn r1540) -Fix: since grf files are reopened on every load/new game, close the old opened to fix stale filehandles (thx tamlin)
darkvater
parents:
1036
diff
changeset
|
120 |
static inline void FioCloseFile(int slot) |
8736f759759b
(svn r1540) -Fix: since grf files are reopened on every load/new game, close the old opened to fix stale filehandles (thx tamlin)
darkvater
parents:
1036
diff
changeset
|
121 |
{ |
8736f759759b
(svn r1540) -Fix: since grf files are reopened on every load/new game, close the old opened to fix stale filehandles (thx tamlin)
darkvater
parents:
1036
diff
changeset
|
122 |
if (_fio.handles[slot] != NULL) { |
1109
1bab892228cd
(svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents:
1093
diff
changeset
|
123 |
fclose(_fio.handles[slot]); |
1039
8736f759759b
(svn r1540) -Fix: since grf files are reopened on every load/new game, close the old opened to fix stale filehandles (thx tamlin)
darkvater
parents:
1036
diff
changeset
|
124 |
_fio.handles[slot] = NULL; |
6218
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
125 |
#if defined(LIMITED_FDS) |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
126 |
_fio.open_handles--; |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
127 |
#endif /* LIMITED_FDS */ |
1039
8736f759759b
(svn r1540) -Fix: since grf files are reopened on every load/new game, close the old opened to fix stale filehandles (thx tamlin)
darkvater
parents:
1036
diff
changeset
|
128 |
} |
8736f759759b
(svn r1540) -Fix: since grf files are reopened on every load/new game, close the old opened to fix stale filehandles (thx tamlin)
darkvater
parents:
1036
diff
changeset
|
129 |
} |
8736f759759b
(svn r1540) -Fix: since grf files are reopened on every load/new game, close the old opened to fix stale filehandles (thx tamlin)
darkvater
parents:
1036
diff
changeset
|
130 |
|
6573 | 131 |
void FioCloseAll() |
0 | 132 |
{ |
133 |
int i; |
|
134 |
||
1039
8736f759759b
(svn r1540) -Fix: since grf files are reopened on every load/new game, close the old opened to fix stale filehandles (thx tamlin)
darkvater
parents:
1036
diff
changeset
|
135 |
for (i = 0; i != lengthof(_fio.handles); i++) |
8736f759759b
(svn r1540) -Fix: since grf files are reopened on every load/new game, close the old opened to fix stale filehandles (thx tamlin)
darkvater
parents:
1036
diff
changeset
|
136 |
FioCloseFile(i); |
0 | 137 |
} |
138 |
||
6218
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
139 |
#if defined(LIMITED_FDS) |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
140 |
static void FioFreeHandle() |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
141 |
{ |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
142 |
/* If we are about to open a file that will exceed the limit, close a file */ |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
143 |
if (_fio.open_handles + 1 == LIMITED_FDS) { |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
144 |
uint i, count; |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
145 |
int slot; |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
146 |
|
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
147 |
count = UINT_MAX; |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
148 |
slot = -1; |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
149 |
/* Find the file that is used the least */ |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
150 |
for (i = 0; i < lengthof(_fio.handles); i++) { |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
151 |
if (_fio.handles[i] != NULL && _fio.usage_count[i] < count) { |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
152 |
count = _fio.usage_count[i]; |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
153 |
slot = i; |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
154 |
} |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
155 |
} |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
156 |
assert(slot != -1); |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
157 |
DEBUG(misc, 6, "Closing filehandler '%s' in slot '%d' because of fd-limit", _fio.filename[slot], slot); |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
158 |
FioCloseFile(slot); |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
159 |
} |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
160 |
} |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
161 |
#endif /* LIMITED_FDS */ |
89dc931b8d78
(svn r8647) -Codechange: add a general way to handle platforms who can only have a limited amount of file-descripters open at any given time.
truelight
parents:
5835
diff
changeset
|
162 |
|
6625
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
163 |
void FioOpenFile(int slot, const char *filename) |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
164 |
{ |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
165 |
FILE *f; |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
166 |
|
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
167 |
#if defined(LIMITED_FDS) |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
168 |
FioFreeHandle(); |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
169 |
#endif /* LIMITED_FDS */ |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
170 |
f = FioFOpenFile(filename); |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
171 |
if (f == NULL) error("Cannot open file '%s%s'", _paths.data_dir, filename); |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
172 |
|
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
173 |
FioCloseFile(slot); // if file was opened before, close it |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
174 |
_fio.handles[slot] = f; |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
175 |
#if defined(LIMITED_FDS) |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
176 |
_fio.filename[slot] = filename; |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
177 |
_fio.usage_count[slot] = 0; |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
178 |
_fio.open_handles++; |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
179 |
#endif /* LIMITED_FDS */ |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
180 |
FioSeekToFile(slot << 24); |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
181 |
} |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
182 |
|
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
183 |
/** |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
184 |
* Check whether the given file exists |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
185 |
* @param filename the file to try for existance |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
186 |
* @return true if and only if the file can be opened |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
187 |
*/ |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
188 |
bool FioCheckFileExists(const char *filename) |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
189 |
{ |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
190 |
FILE *f = FioFOpenFile(filename); |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
191 |
if (f == NULL) return false; |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
192 |
|
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
193 |
fclose(f); |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
194 |
return true; |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
195 |
} |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
196 |
|
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
197 |
/** |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
198 |
* Opens the file with the given name |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
199 |
* @param filename the file to open (in either data_dir or second_data_dir) |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
200 |
* @return the opened file or NULL when it failed. |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
201 |
*/ |
2736
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
202 |
FILE *FioFOpenFile(const char *filename) |
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
203 |
{ |
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
204 |
FILE *f; |
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
205 |
char buf[MAX_PATH]; |
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
206 |
|
5296
6a4aaa66eed3
(svn r7449) -Codechange: Rename _path to _paths as it is technically more correct, but mainly because
Darkvater
parents:
5170
diff
changeset
|
207 |
snprintf(buf, lengthof(buf), "%s%s", _paths.data_dir, filename); |
2736
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
208 |
|
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
209 |
f = fopen(buf, "rb"); |
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
210 |
#if !defined(WIN32) |
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
211 |
if (f == NULL) { |
5296
6a4aaa66eed3
(svn r7449) -Codechange: Rename _path to _paths as it is technically more correct, but mainly because
Darkvater
parents:
5170
diff
changeset
|
212 |
strtolower(buf + strlen(_paths.data_dir) - 1); |
2736
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
213 |
f = fopen(buf, "rb"); |
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
214 |
|
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
215 |
#if defined SECOND_DATA_DIR |
6505
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6218
diff
changeset
|
216 |
/* tries in the 2nd data directory */ |
2736
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
217 |
if (f == NULL) { |
5296
6a4aaa66eed3
(svn r7449) -Codechange: Rename _path to _paths as it is technically more correct, but mainly because
Darkvater
parents:
5170
diff
changeset
|
218 |
snprintf(buf, lengthof(buf), "%s%s", _paths.second_data_dir, filename); |
6a4aaa66eed3
(svn r7449) -Codechange: Rename _path to _paths as it is technically more correct, but mainly because
Darkvater
parents:
5170
diff
changeset
|
219 |
strtolower(buf + strlen(_paths.second_data_dir) - 1); |
2736
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
220 |
f = fopen(buf, "rb"); |
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
221 |
} |
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
222 |
#endif |
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
223 |
} |
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
224 |
#endif |
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
225 |
|
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
226 |
return f; |
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
227 |
} |
1ea068235989
(svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
2548
diff
changeset
|
228 |
|
6624
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
229 |
/** |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
230 |
* Create a directory with the given name |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
231 |
* @param name the new name of the directory |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
232 |
*/ |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
233 |
void FioCreateDirectory(const char *name) |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
234 |
{ |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
235 |
#if defined(WIN32) || defined(WINCE) |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
236 |
CreateDirectory(OTTD2FS(name), NULL); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
237 |
#elif defined(OS2) && !defined(__INNOTEK_LIBC__) |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
238 |
mkdir(OTTD2FS(name)); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
239 |
#else |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
240 |
mkdir(OTTD2FS(name), 0755); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
241 |
#endif |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
242 |
} |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
243 |
|
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
244 |
/** |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
245 |
* Appends, if necessary, the path separator character to the end of the string. |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
246 |
* It does not add the path separator to zero-sized strings. |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
247 |
* @param buf string to append the separator to |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
248 |
* @param buflen the length of the buf |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
249 |
*/ |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
250 |
void AppendPathSeparator(char *buf, size_t buflen) |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
251 |
{ |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
252 |
size_t s = strlen(buf); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
253 |
|
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
254 |
/* Length of string + path separator + '\0' */ |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
255 |
if (s != 0 && buf[s - 1] != PATHSEPCHAR && s + 2 < buflen) { |
6625
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
256 |
buf[s] = PATHSEPCHAR; |
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
257 |
buf[s + 1] = '\0'; |
6624
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
258 |
} |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
259 |
} |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
260 |
|
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
261 |
/** |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
262 |
* Determine the base (personal dir and game data dir) paths |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
263 |
* @note defined in the OS related files (os2.cpp, win32.cpp, unix.cpp etc) |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
264 |
*/ |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
265 |
extern void DetermineBasePaths(); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
266 |
|
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
267 |
/** |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
268 |
* Acquire the base paths (personal dir and game data dir), |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
269 |
* fill all other paths (save dir, autosave dir etc) and |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
270 |
* make the save and scenario directories. |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
271 |
* @todo for save_dir, autosave_dir, scenario_dir and heightmap_dir the |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
272 |
* assumption is that there is no path separator, however for gm_dir |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
273 |
* lang_dir and data_dir that assumption is made. |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
274 |
* This inconsistency should be resolved. |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
275 |
*/ |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
276 |
void DeterminePaths() |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
277 |
{ |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
278 |
DetermineBasePaths(); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
279 |
|
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
280 |
_paths.save_dir = str_fmt("%ssave", _paths.personal_dir); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
281 |
_paths.autosave_dir = str_fmt("%s" PATHSEP "autosave", _paths.save_dir); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
282 |
_paths.scenario_dir = str_fmt("%sscenario", _paths.personal_dir); |
6625
3348b52bd823
(svn r9130) -Codechange: move the fileio functions that do open a file into a Fio slot together.
rubidium
parents:
6624
diff
changeset
|
283 |
_paths.heightmap_dir = str_fmt("%s" PATHSEP "heightmap", _paths.scenario_dir); |
6624
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
284 |
_paths.gm_dir = str_fmt("%sgm" PATHSEP, _paths.game_data_dir); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
285 |
_paths.data_dir = str_fmt("%sdata" PATHSEP, _paths.game_data_dir); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
286 |
#if defined(CUSTOM_LANG_DIR) |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
287 |
/* Sets the search path for lng files to the custom one */ |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
288 |
_paths.lang_dir = MallocT<char>(MAX_PATH); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
289 |
ttd_strlcpy(_paths.lang_dir, CUSTOM_LANG_DIR, MAX_PATH); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
290 |
#else |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
291 |
_paths.lang_dir = str_fmt("%slang" PATHSEP, _paths.game_data_dir); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
292 |
#endif |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
293 |
|
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
294 |
if (_config_file == NULL) { |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
295 |
_config_file = str_fmt("%sopenttd.cfg", _paths.personal_dir); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
296 |
} |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
297 |
|
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
298 |
_highscore_file = str_fmt("%shs.dat", _paths.personal_dir); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
299 |
_log_file = str_fmt("%sopenttd.log", _paths.personal_dir); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
300 |
|
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
301 |
/* Make (auto)save and scenario folder */ |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
302 |
FioCreateDirectory(_paths.save_dir); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
303 |
FioCreateDirectory(_paths.autosave_dir); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
304 |
FioCreateDirectory(_paths.scenario_dir); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
305 |
FioCreateDirectory(_paths.heightmap_dir); |
554e5aee6c3f
(svn r9129) -Codechange: unify parts of DeterminePaths.
rubidium
parents:
6574
diff
changeset
|
306 |
} |