When the file path is not preset, check for this and don’t let
readProperties() fail with an exception, since this makes for very
noisy event reporting.
When starting at an airport, but not at parking or a runway, create
an empty AIFlightPlan, and ensure the AIManager code doesn’t choke on
empty FPs.
Add a unit-test which simulates the C172 tutorial reposition logic,
which is a little gnarly.
Allow mis-match of STAR and approach, which is necessary for EDDF
operations. When there’s a mismatch, just route the common section
and don’t try to build a STAR -> approach transition.
Fix by Tobias Dammers.
When reachedEndOfCruise fails, return true, so we trigger the next
phase of the flight. Without this we get stuck logging the error
message, but not progressing the flight.
- Refuse to recursively delete a directory that does not contain a
.dirindex file. This will protect users against data loss in case they
inadvertently use the --remove-orphan option with the wrong target
directory.
- Correctly handle the case where we have a file on disk that is now
listed as a directory on the server: remove the file if we are in
'sync' mode, so that the directory can be created and sync'ed from the
server.
- only accept ASCII-encoded .dirindex files (this is guaranteed to work
fine "everywhere");
- reject .dirindex files with a 'path' entry that contains a backslash
or starts with a slash;
- reject .dirindex files with a 'path' entry that contains a '..'
component;
- reject .dirindex files with an 'f', 'd' or 't' entry whose name field
contains a slash or a backslash;
- reject .dirindex files with an 'f', 'd' or 't' entry whose name field
is '..';
- add comment lines (starting with '#') in the sample good .dirindex
file used by unit tests.
Remove the 'if __name__ == "__main__": unittest.main()'. Indeed, the
module can't be run this way due to its imports. Tests from this module
can be run with:
cd scripts/python/TerraSync
python3 -m unittest tests.test_virtual_path
In Python, common usage is not to define accessors, but to directly use
class or instance attributes (especially when the associated data is
constant after instance creation). If it later happens that a given
attribute needs getter or setter logic, this can always be done via the
@property decorator, and doesn't affect calling code at all. See for
instance:
https://docs.python.org/3/library/functions.html#propertyhttps://mail.python.org/pipermail/tutor/2012-December/thread.html#92990
Apply this to the DirIndex class and rename the following attributes for
better readability: f -> files, d -> directories, t -> tarballs.
The tests can be run from directory 'scripts/python/TerraSync' using:
python3 -m unittest tests.test_dirindex
(or just 'python3 -m unittest' to run all tests pertaining to
terrasync.py).
python3 has a default implementation for __ne__ when __eq__ is defined. The opposite is not true -- having only __ne__ does not have a default __eq__ implementation.
Also note that there are cases when eq/ne will both be True or both False, therefore, developers are encouraged to explicitly define these methods in pairs.
- Use a range-based for loop instead of an iterator.
- Don't bother checking if the previously-visited directory was the
same: the potential saving that the previous code was hoping should be
null because FGGlobals::append_fg_scenery() doesn't add a path to
FGGlobals::fg_scenery if it's already there---this assumes that all
paths added to FGGlobals::fg_scenery go through
FGGlobals::append_fg_scenery(), of course.
This should have no effect on FG's behavior.