| 41 | { |
| 42 | |
| 43 | bool MountDefaults() |
| 44 | { |
| 45 | String path = getAssetDir(); |
| 46 | |
| 47 | bool mounted = Mount( "game", createNativeFS( path )); |
| 48 | |
| 49 | if ( !mounted ) |
| 50 | return false; |
| 51 | |
| 52 | #ifdef TORQUE_SECURE_VFS |
| 53 | mounted = Mount("/", createNativeFS(path)); |
| 54 | if (!mounted) |
| 55 | { |
| 56 | return false; |
| 57 | } |
| 58 | #endif |
| 59 | |
| 60 | #ifndef TORQUE_DISABLE_VIRTUAL_MOUNT_SYSTEM |
| 61 | // Always mount the data & home dir so scripts work in either configuration. This is used for eg. preferences storage. |
| 62 | Path dataDirectory = Platform::getUserDataDirectory(); |
| 63 | Path appDataDirectory = Path::Join(dataDirectory.getFullPath().c_str(), '/', TORQUE_APP_NAME); |
| 64 | Path homeDirectory = Platform::getUserHomeDirectory(); |
| 65 | Path appHomeDirectory = Path::Join(homeDirectory.getFullPath().c_str(), '/', TORQUE_APP_NAME); |
| 66 | |
| 67 | // Ensure the root of the data directory exists before trying to mount data VFS |
| 68 | if (!Platform::FS::IsDirectory(appDataDirectory) && !Platform::FS::CreateDirectory(appDataDirectory)) |
| 69 | { |
| 70 | // NOTE: We can't Con::errorf here because it doesn't actually output by this point in execution |
| 71 | } |
| 72 | |
| 73 | // Ensure the root of the home directory exists before trying to mount home VFS |
| 74 | if (!Platform::FS::IsDirectory(appHomeDirectory) && !Platform::FS::CreateDirectory(appHomeDirectory)) |
| 75 | { |
| 76 | // NOTE: We can't Con::errorf here because it doesn't actually output by this point in execution |
| 77 | } |
| 78 | |
| 79 | // data:/ points to a directory that is usually buried someplace harder to reach on OS |
| 80 | mounted = Mount("data", Platform::FS::createNativeFS(appDataDirectory.getFullPath())); |
| 81 | if (!mounted) |
| 82 | { |
| 83 | // NOTE: We can't Con::errorf here because it doesn't actually output by this point in execution |
| 84 | return false; |
| 85 | } |
| 86 | |
| 87 | // home:/ refers to your Documents/<APPNAME> folder which is easier to reach than the data:/ mount |
| 88 | mounted = Mount("home", Platform::FS::createNativeFS(appHomeDirectory.getFullPath())); |
| 89 | if (!mounted) |
| 90 | { |
| 91 | // NOTE: We can't Con::errorf here because it doesn't actually output by this point in execution |
| 92 | return false; |
| 93 | } |
| 94 | |
| 95 | // Note that the VirtualMountSystem must be enabled in volume.cpp for zip support to work. |
| 96 | return MountZips("game"); |
| 97 | #else |
| 98 | return true; |
| 99 | #endif |
| 100 | } |
no test coverage detected