1
0
forked from 0ad/0ad
0ad/source/lib
wraitii 87a2c3347f Make real directory paths on the VFS predictable (retry)
This is the same commit as 4bb31f084e, reverted in 5d1899785a. Noted
issues were fixed.

Partial revert/fix of 2f19cf86d3 and 2567fee329.

Before this diff, it was possible for a mod containing a cache/ or a
config/ folder to get written to incorrectly.
The issue is VFS can map multiple directories to one 'virtual' path, for
reading mods. However, writing data is problematic: which path to
choose?
The only viable solution is to use a path relative to the highest
priority directory encountered in the VFS path, or write paths could be
'hijacked' by lower-priority mods.

This fixes these issues by:
- Adding a new lookup mode ('Real-path') that explicitly picks the real
path relative to the highest-priority subdirectory in the VFS Path.
- Preventing overwriting a real directory with a lower priority one in
general.
- Revert c0c8132dd4's GetRealPath change, re-introducing the function as
GetOriginalPath.

This also cleans up some duplication that led to empty mod folders in
the user mod path, and cleans up loading the 'user' mod.
It also makes it explicit that a directory must be passed to Mount().

Note that the new 'realpath' lookup can still be somewhat complex with
many mount points at various hierarchy levels, but it is at least
predictable/deterministic without having to be careful about populating
order.

Fixes #2553

Differential Revision: https://code.wildfiregames.com/D3728
This was SVN commit r25107.
2021-03-23 12:46:59 +00:00
..
adts Removes unused containers included in headers. 2021-03-03 23:01:08 +00:00
allocators Guarantees no memset for allocation of DynamicArena::Block 2021-03-01 20:35:30 +00:00
external_libraries Replaces UNICODE characters in the code by consistent ASCII characters. 2021-01-15 10:07:36 +00:00
file Make real directory paths on the VFS predictable (retry) 2021-03-23 12:46:59 +00:00
pch Fix and disable some pesky Windows warnings. 2021-02-05 12:20:06 +00:00
posix Fix compilation error on FreeBSD. MAP_NO_RESERVE was never implemented, and as such had no effect there. 2021-01-05 19:06:36 +00:00
res Further header & precompiled cleanup, fix no-PCH builds. 2020-12-09 14:39:14 +00:00
sysdep Add missing file in previous commit. 2021-03-03 15:18:44 +00:00
tests Further header & precompiled cleanup, fix no-PCH builds. 2020-12-09 14:39:14 +00:00
tex Fix logic issue with the DXT1a texture format, refs #4549. 2020-08-18 16:45:56 +00:00
alignment.h Enable support for powerpc64 systems. New problems with NVTT will be addressed in another diff. 2021-03-03 15:13:47 +00:00
app_hooks.cpp Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
app_hooks.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
base32.cpp Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
base32.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
bits.cpp Further header & precompiled cleanup, fix no-PCH builds. 2020-12-09 14:39:14 +00:00
bits.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
byte_order.cpp Further header & precompiled cleanup, fix no-PCH builds. 2020-12-09 14:39:14 +00:00
byte_order.h Enable support for powerpc64 systems. New problems with NVTT will be addressed in another diff. 2021-03-03 15:13:47 +00:00
code_annotation.h Add missing files in 4942cabab5 2020-12-31 14:27:02 +00:00
code_generation.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
config2.h Fix the random slowdowns and speedups on AMD CPUs for Windows 2020-11-06 23:18:16 +00:00
config.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
debug_stl.cpp Further header & precompiled cleanup, fix no-PCH builds. 2020-12-09 14:39:14 +00:00
debug_stl.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
debug.cpp Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
debug.h Refactors water shader to move refraction in a separate function. 2020-10-25 21:00:52 +00:00
fnv_hash.cpp Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
fnv_hash.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
frequency_filter.cpp Fix compiler warnings on VS 2015, refs #3439, refs #5069. 2018-03-10 09:58:53 +00:00
frequency_filter.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
hash.h Replace boost::unordered_map, boost::unordered_set with std::unordered_map, std::unordered_set to establish consistency. 2019-11-25 14:30:25 +00:00
input.cpp Further header & precompiled cleanup, fix no-PCH builds. 2020-12-09 14:39:14 +00:00
input.h Bump year number of files changed this year in the license headers. 2017-05-01 14:28:22 +00:00
lib_api.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
lib.cpp Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
lib.h Removes duplication of Clamp function. 2019-09-26 21:14:21 +00:00
module_init.cpp Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
module_init.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
ogl.cpp Bump year number of files changed this year in the license headers. 2017-05-01 14:28:22 +00:00
ogl.h Bump year number of files changed this year in the license headers. 2017-05-01 14:28:22 +00:00
os_path.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
path.cpp Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
path.h Add missing files in 4942cabab5 2020-12-31 14:27:02 +00:00
precompiled.h Drop support for compiling with Visual Studio 2015 2020-11-28 16:54:48 +00:00
rand.cpp Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
rand.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
regex.cpp Further header & precompiled cleanup, fix no-PCH builds. 2020-12-09 14:39:14 +00:00
regex.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
secure_crt.cpp Further header & precompiled cleanup, fix no-PCH builds. 2020-12-09 14:39:14 +00:00
secure_crt.h Clean up header includes, add new forward declarations. 2020-11-21 11:20:29 +00:00
self_test.h Adds Camera test for ortho projection. 2019-06-05 19:55:37 +00:00
status.cpp Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
status.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
svn_revision.cpp Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
svn_revision.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
timer.cpp Replace CLOCK_REALTIME by CLOCK_MONOTONIC as suggested by @janwas. 2021-01-04 11:08:19 +00:00
timer.h Fix non-visual replay on Windows. Use the actual detected resolution. 2020-12-12 08:18:24 +00:00
types.h Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
utf8.cpp Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00
utf8.h Further header & precompiled cleanup, fix no-PCH builds. 2020-12-09 14:39:14 +00:00
wsecure_crt.cpp Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c). 2017-07-10 14:26:24 +00:00