No description
Add classes VirtualPath and MutableVirtualPath (the latter derived from the former) to manipulate slash-separated paths where the root '/' represents the TerraScenery root. This makes it clear what a function expects when you see that one of its arguments is a VirtualPath instance: you don't have to ask yourself whether it can start or end with a slash, how to interpret it, etc. Operating on these paths is also easy[1], be it to assemble URLs in order to retrieve files or to join their relative part with a local directory path in order to obtain a real (deeper) local path. VirtualPath and MutableVirtualPath are essentially the same; the former is hashable and therefore has to be immutable, whereas the latter can be modified in-place with the /= operator (used to append path components), and therefore can't be hashable. As a consequence, MutableVirtualPath instances can't be used as dictionary keys, elements of a set or frozenset, etc. VirtualPath and MutableVirtualPath use the pathlib.PurePath API where applicable (part of this API has been implemented in [Mutable]VirtualPath; more can be added, of course). These classes have no assumptions related to TerraSync and thus should be fit for use in other projects. To convert a [Mutable]VirtualPath instance to a string, just use str() on it. The result is guaranteed to start with a '/' and not to end with a '/', except for the virtual root '/'. Upon construction, the given string is interpreted relatively to the virtual root, i.e.: VirtualPath("") == VirtualPath("/") VirtualPath("abc/def/ghi") == VirtualPath("/abc/def/ghi") etc. VirtualPath and MutableVirtualPath instances sort like the respective strings str() converts them too. The __hash__() method of VirtualPath is based on the type and this string representation, too. Such objects can only compare equal (using ==) if they have the same type. If you want to compare the underlying virtual paths inside a VirtualPath and a MutableVirtualPath, use the samePath() method of either class. For more info, see scripts/python/TerraSync/terrasync/virtual_path.py and unit tests in scripts/python/TerraSync/tests/test_virtual_path.py. [1] Most useful is the / operator, which works as for SGPath: VirtualPath("/abc/def/ghi") == VirtualPath("/abc") / "def" / "ghi" VirtualPath("/abc/def/ghi") == VirtualPath("/abc") / "def/ghi" |
||
---|---|---|
3rdparty | ||
CMakeModules | ||
docs-mini | ||
examples/netfdm | ||
icons | ||
man | ||
package | ||
scripts | ||
src | ||
tests | ||
utils | ||
.gitignore | ||
AUTHORS | ||
ChangeLog | ||
CMakeLists.txt | ||
COPYING | ||
INSTALL | ||
NEWS | ||
README | ||
README.cmake | ||
README.msvc | ||
README.OpenAL | ||
README.OSG | ||
README.plib | ||
README.SimGear | ||
Thanks | ||
version |
Welcome to the FlightGear Flight Simulator project. =================================================== The primary web page for this project is: http://www.flightgear.org For basic installation instructions see the "INSTALL" file. Before you can run FlightGear you will also need to download and install the "base" package which is a collection of textures, sounds, sample scenery, and other data files needed by the sim. For additional install help for specific platforms please browse the "docs-mini/" subdirectory. More complete documentation is available from our web page as a separate distribution. Please take a look at the "Thanks" file for a list of people who have contributed to this project. If you have contributed something but don't find your name in this file. Please send a polite reminder to http://www.flightgear.org/~curt For a summary of changes/additions by version see the "NEWS" file. This project is GPL'd. For complete details on our licensing please see the "COPYING" file. For information on available mailing lists, mailing list archives, and other available source code and documenation, please visit our web site. FlightGear is a product of the collaboration of large international group of volunteers. FlightGear is a work in progress. FlightGear comes with no warrantee. We hope you enjoy FlightGear and/or find it of some value!