diff -EbwuNr backends/fs/posix/posix-fs.cpp.org backends/fs/posix/posix-fs.cpp
old
|
new
|
|
35 | 35 | #include <stdio.h> |
36 | 36 | #include <unistd.h> |
37 | 37 | |
| 38 | #ifdef __OS2__ |
| 39 | #define INCL_DOS |
| 40 | #include <os2.h> |
| 41 | #endif |
| 42 | |
38 | 43 | /** |
39 | 44 | * Implementation of the ScummVM file system API based on POSIX. |
40 | 45 | * |
… |
… |
|
158 | 163 | bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const { |
159 | 164 | assert(_isDirectory); |
160 | 165 | |
| 166 | #ifdef __OS2__ |
| 167 | if (_path == "/") { |
| 168 | ULONG ulDrvNum; |
| 169 | ULONG ulDrvMap; |
| 170 | |
| 171 | DosQueryCurrentDisk(&ulDrvNum, &ulDrvMap); |
| 172 | |
| 173 | for (int i = 0; i < 26; i++) { |
| 174 | if (ulDrvMap & 1) { |
| 175 | char drive_root[4]; |
| 176 | |
| 177 | drive_root[0] = i + 'A'; |
| 178 | drive_root[1] = ':'; |
| 179 | drive_root[2] = '/'; |
| 180 | drive_root[3] = 0; |
| 181 | |
| 182 | POSIXFilesystemNode entry; |
| 183 | |
| 184 | entry._isDirectory = true; |
| 185 | entry._isValid = true; |
| 186 | entry._path = drive_root; |
| 187 | entry._displayName = "[" + String(drive_root, 2) + "]"; |
| 188 | myList.push_back(new POSIXFilesystemNode(entry)); |
| 189 | } |
| 190 | |
| 191 | ulDrvMap >>= 1; |
| 192 | } |
| 193 | } |
| 194 | else { |
| 195 | #endif |
161 | 196 | DIR *dirp = opendir(_path.c_str()); |
162 | 197 | struct dirent *dp; |
163 | 198 | |
… |
… |
|
226 | 261 | } |
227 | 262 | closedir(dirp); |
228 | 263 | |
| 264 | #ifdef __OS2__ |
| 265 | } |
| 266 | #endif |
| 267 | |
229 | 268 | return true; |
230 | 269 | } |
231 | 270 | |
… |
… |
|
236 | 275 | const char *start = _path.c_str(); |
237 | 276 | const char *end = lastPathComponent(_path); |
238 | 277 | |
| 278 | #ifdef __OS2__ |
| 279 | if (end == startx) |
| 280 | return new POSIXFilesystemNode(); |
| 281 | #endif |
| 282 | |
239 | 283 | return new POSIXFilesystemNode(String(start, end - start), true); |
240 | 284 | } |
241 | 285 | |