Function invoked by the kernel layer to install OS specific file systems.
| 755 | /// Function invoked by the kernel layer to install OS specific |
| 756 | /// file systems. |
| 757 | bool Platform::FS::InstallFileSystems() |
| 758 | { |
| 759 | WCHAR buffer[1024]; |
| 760 | |
| 761 | // [8/24/2009 tomb] This stops Windows from complaining about drives that have no disks in |
| 762 | SetErrorMode(SEM_FAILCRITICALERRORS); |
| 763 | |
| 764 | // Load all the Win32 logical drives. |
| 765 | DWORD mask = ::GetLogicalDrives(); |
| 766 | char drive[] = "A"; |
| 767 | char volume[] = "A:/"; |
| 768 | while (mask) |
| 769 | { |
| 770 | if (mask & 1) |
| 771 | { |
| 772 | volume[0] = drive[0]; |
| 773 | Platform::FS::Mount(drive, Platform::FS::createNativeFS(volume)); |
| 774 | } |
| 775 | mask >>= 1; |
| 776 | drive[0]++; |
| 777 | } |
| 778 | |
| 779 | // Set the current working dir. Windows normally returns |
| 780 | // upper case driver letters, but the cygwin bash shell |
| 781 | // seems to make it return lower case drives. Force upper |
| 782 | // to be consistent with the mounts. |
| 783 | ::GetCurrentDirectory(sizeof(buffer), buffer); |
| 784 | |
| 785 | if (buffer[1] == ':') |
| 786 | buffer[0] = dToupper(buffer[0]); |
| 787 | |
| 788 | String wd = buffer; |
| 789 | |
| 790 | wd += '/'; |
| 791 | |
| 792 | Platform::FS::SetCwd(wd); |
| 793 | |
| 794 | return true; |
| 795 | } |
| 796 | |
| 797 |