mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
* BugFix: Mount home:/ to refer to Torque's original Documents/<APPNAME> output for eg. prefs while leaving data:/ as an option for those that may want it.
This commit is contained in:
parent
59cf242a7a
commit
3dafdef5da
2 changed files with 20 additions and 3 deletions
|
|
@ -57,9 +57,12 @@ bool MountDefaults()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Always mount the data dir so scripts work in either configuration. This is used for eg. preferences storage.
|
#ifndef TORQUE_DISABLE_VIRTUAL_MOUNT_SYSTEM
|
||||||
|
// Always mount the data & home dir so scripts work in either configuration. This is used for eg. preferences storage.
|
||||||
Path dataDirectory = Platform::getUserDataDirectory();
|
Path dataDirectory = Platform::getUserDataDirectory();
|
||||||
Path appDataDirectory = Path::Join(dataDirectory.getFullPath().c_str(), '/', TORQUE_APP_NAME);
|
Path appDataDirectory = Path::Join(dataDirectory.getFullPath().c_str(), '/', TORQUE_APP_NAME);
|
||||||
|
Path homeDirectory = Platform::getUserHomeDirectory();
|
||||||
|
Path appHomeDirectory = Path::Join(homeDirectory.getFullPath().c_str(), '/', TORQUE_APP_NAME);
|
||||||
|
|
||||||
// Ensure the root of the data directory exists before trying to mount data VFS
|
// Ensure the root of the data directory exists before trying to mount data VFS
|
||||||
if (!Platform::FS::IsDirectory(appDataDirectory) && !Platform::FS::CreateDirectory(appDataDirectory))
|
if (!Platform::FS::IsDirectory(appDataDirectory) && !Platform::FS::CreateDirectory(appDataDirectory))
|
||||||
|
|
@ -67,6 +70,13 @@ bool MountDefaults()
|
||||||
// NOTE: We can't Con::errorf here because it doesn't actually output by this point in execution
|
// NOTE: We can't Con::errorf here because it doesn't actually output by this point in execution
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure the root of the home directory exists before trying to mount home VFS
|
||||||
|
if (!Platform::FS::IsDirectory(appHomeDirectory) && !Platform::FS::CreateDirectory(appHomeDirectory))
|
||||||
|
{
|
||||||
|
// NOTE: We can't Con::errorf here because it doesn't actually output by this point in execution
|
||||||
|
}
|
||||||
|
|
||||||
|
// data:/ points to a directory that is usually buried someplace harder to reach on OS
|
||||||
mounted = Mount("data", Platform::FS::createNativeFS(appDataDirectory.getFullPath()));
|
mounted = Mount("data", Platform::FS::createNativeFS(appDataDirectory.getFullPath()));
|
||||||
if (!mounted)
|
if (!mounted)
|
||||||
{
|
{
|
||||||
|
|
@ -74,7 +84,14 @@ bool MountDefaults()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TORQUE_DISABLE_VIRTUAL_MOUNT_SYSTEM
|
// home:/ refers to your Documents/<APPNAME> folder which is easier to reach than the data:/ mount
|
||||||
|
mounted = Mount("home", Platform::FS::createNativeFS(appHomeDirectory.getFullPath()));
|
||||||
|
if (!mounted)
|
||||||
|
{
|
||||||
|
// NOTE: We can't Con::errorf here because it doesn't actually output by this point in execution
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Note that the VirtualMountSystem must be enabled in volume.cpp for zip support to work.
|
// Note that the VirtualMountSystem must be enabled in volume.cpp for zip support to work.
|
||||||
return MountZips("game");
|
return MountZips("game");
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ function getUserPath()
|
||||||
|
|
||||||
function getPrefpath()
|
function getPrefpath()
|
||||||
{
|
{
|
||||||
$prefPath = "data:/preferences";
|
$prefPath = "home:/preferences";
|
||||||
return $prefPath;
|
return $prefPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue