src/os2.cpp
branchNewGRF_ports
changeset 6732 ca1b466db422
parent 6720 35756db7e577
child 6743 cabfaa4a0295
equal deleted inserted replaced
6731:d5fc4446b833 6732:ca1b466db422
    42 
    42 
    43 #ifndef __INNOTEK_LIBC__
    43 #ifndef __INNOTEK_LIBC__
    44 	_dos_getdrive(&save); // save original drive
    44 	_dos_getdrive(&save); // save original drive
    45 #else
    45 #else
    46 	save = _getdrive(); // save original drive
    46 	save = _getdrive(); // save original drive
       
    47 	char wd[MAX_PATH];
       
    48 	getcwd(wd, MAX_PATH);
    47 	total = 'z';
    49 	total = 'z';
    48 #endif
    50 #endif
    49 
    51 
    50 	/* get an available drive letter */
    52 	/* get an available drive letter */
    51 #ifndef __INNOTEK_LIBC__
    53 #ifndef __INNOTEK_LIBC__
    53 		_dos_setdrive(disk, &total);
    55 		_dos_setdrive(disk, &total);
    54 #else
    56 #else
    55 	for (disk = 'A';; disk++) {
    57 	for (disk = 'A';; disk++) {
    56 		_chdrive(disk);
    58 		_chdrive(disk);
    57 #endif
    59 #endif
    58 		if (disk >= total) return;
    60 		if (disk >= total)  break;
    59 
    61 
    60 #ifndef __INNOTEK_LIBC__
    62 #ifndef __INNOTEK_LIBC__
    61 		_dos_getdrive(&disk2);
    63 		_dos_getdrive(&disk2);
    62 #else
    64 #else
    63 		disk2 = _getdrive();
    65 		disk2 = _getdrive();
    78 
    80 
    79 	/* Restore the original drive */
    81 	/* Restore the original drive */
    80 #ifndef __INNOTEK_LIBC__
    82 #ifndef __INNOTEK_LIBC__
    81 	_dos_setdrive(save, &total);
    83 	_dos_setdrive(save, &total);
    82 #else
    84 #else
    83 	_chdrive(save);
    85 	chdir(wd);
    84 #endif
    86 #endif
    85 }
    87 }
    86 
    88 
    87 bool FiosGetDiskFreeSpace(const char *path, uint32 *tot)
    89 bool FiosGetDiskFreeSpace(const char *path, uint32 *tot)
    88 {
    90 {