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