|
| 1 | +# Design for Virtual Filesystem |
| 2 | + |
| 3 | +Based on http://www.elvastower.com/forums/index.php?/topic/16633-overall-file-system-and-data-structure/page__st__10__p__78514#entry78514 |
| 4 | +and http://www.elvastower.com/forums/index.php?/topic/16633-overall-file-system-and-data-structure/page__view__findpost__p__262013 |
| 5 | + |
| 6 | +## Containment |
| 7 | +Content packages are folders which may contain any number of files and folders and reference other packages. |
| 8 | +This avoid duplication of files which is convenient for developing content. |
| 9 | + |
| 10 | +As an alternative, a package may contain a single zip file which is treated as though it had been unzipped into the package folder. A package can be added with a single copy operation and removed with a single delete operation, which is convenient for distributing content and for simpler installing and uninstalling of content. |
| 11 | +The name of the zip file would not be significant. |
| 12 | + |
| 13 | +## OR and MSTS |
| 14 | +Packages contain one of two possible organisations for folders: "OR" and "MSTS". |
| 15 | +In the MSTS organisation, the content is organised using the conventional folders GLOBAL, ROUTES, SOUND, TRAINS, etc. |
| 16 | +In the OR organisation, the content is organised in folders by usage: Shapes, Textures etc. |
| 17 | +In this organisation, there are no folders called Global or Common.cab shared by using paths such as "..\..\". |
| 18 | + |
| 19 | +### Path Delimiter |
| 20 | +"/" is used to avoid confusion with the "\" escape character and also to differentiate this filesystem from the Windows filesystem. |
| 21 | + |
| 22 | +## Assembling a Virtual Filesystem |
| 23 | +Open Rails provides access to the files from multiple content packages as in these examples: |
| 24 | + |
| 25 | +### Scenario A: Two different OR content packages in ZIP format. |
| 26 | + =YoRyan_SuperlinerInteriors.zip= |
| 27 | + OR/ |
| 28 | + YoRyan_SuperlinerInteriors/ |
| 29 | + Shapes/ |
| 30 | + supercoach.s |
| 31 | + superdiner.s |
| 32 | + superlounge.s |
| 33 | + Textures/ |
| 34 | + supercoach.ace |
| 35 | + superdiner.ace |
| 36 | + superlounge.ace |
| 37 | + |
| 38 | + =YoRyan_DerailFlag.zip= |
| 39 | + OR/ |
| 40 | + YoRyan_DerailFlag/ |
| 41 | + Shapes/ |
| 42 | + derailflag.s |
| 43 | + Textures/ |
| 44 | + derailflag.ace |
| 45 | + |
| 46 | +The simulator combines both of these packages into a single virtual filesystem: |
| 47 | + |
| 48 | + OR/ |
| 49 | + YoRyan_SuperlinerInteriors/ |
| 50 | + Shapes/ |
| 51 | + supercoach.s |
| 52 | + superdiner.s |
| 53 | + superlounge.s |
| 54 | + Textures/ |
| 55 | + supercoach.ace |
| 56 | + superdiner.ace |
| 57 | + superlounge.ace |
| 58 | + YoRyan_DerailFlag/ |
| 59 | + Shapes/ |
| 60 | + derailflag.s |
| 61 | + Textures/ |
| 62 | + derailflag.ace |
| 63 | + |
| 64 | +### Scenario B: Two identically-named OR content packages in ZIP format. |
| 65 | +In this case, the second package contains a file intended to override the file of the same name in the first package. |
| 66 | + |
| 67 | + =YoRyan_SuperlinerInteriors.zip= |
| 68 | + OR/ |
| 69 | + YoRyan_SuperlinerInteriors/ |
| 70 | + Shapes/ |
| 71 | + supercoach.s |
| 72 | + superdiner.s |
| 73 | + superlounge.s |
| 74 | + Textures/ |
| 75 | + supercoach.ace |
| 76 | + superdiner.ace |
| 77 | + superlounge.ace |
| 78 | + |
| 79 | + =SupercoachReplacementSeats= |
| 80 | + OR/ |
| 81 | + YoRyan_SuperlinerInteriors/ *same package name as previous package |
| 82 | + Textures/ |
| 83 | + supercoach.ace |
| 84 | + |
| 85 | +and the virtual filesystem shows the second package overriding the first. |
| 86 | + |
| 87 | + OR/ |
| 88 | + YoRyan_SuperlinerInteriors/ |
| 89 | + Shapes/ |
| 90 | + supercoach.s |
| 91 | + superdiner.s |
| 92 | + superlounge.s |
| 93 | + Textures/ |
| 94 | + supercoach.ace *from SupercoachReplacementSeats.zip |
| 95 | + superdiner.ace |
| 96 | + superlounge.ace |
| 97 | + |
| 98 | +The load order can be modified by the user. |
| 99 | + |
| 100 | +### Scenario C: Multiple MSTS content packages in ZIP format. |
| 101 | +This example has a base package for the Kuju stock stuff, an XTracks package and packages for activities and timetables. |
| 102 | + |
| 103 | + =MicrosoftTrainSimulator1.2.zip= |
| 104 | + MSTS/ |
| 105 | + GLOBAL/ |
| 106 | + ... |
| 107 | + SOUND/ |
| 108 | + ... |
| 109 | + ROUTES/ |
| 110 | + ... |
| 111 | + TRAINS/ |
| 112 | + ... |
| 113 | + |
| 114 | + =XTracks_Nov2019.zip= |
| 115 | + MSTS/ |
| 116 | + GLOBAL/ |
| 117 | + SHAPES/ |
| 118 | + ... |
| 119 | + |
| 120 | + =YoRyan_MSTSTimetables.zip= |
| 121 | + MSTS/ |
| 122 | + ROUTES/ |
| 123 | + USA1/ |
| 124 | + ACTIVITIES/ |
| 125 | + YoRyan_USA1_Amtrak.timetable-or |
| 126 | + PATHS/ |
| 127 | + ... |
| 128 | + USA2/ |
| 129 | + ACTIVITIES/ |
| 130 | + YoRyan_USA2_EmpireBuilder.timetable-or |
| 131 | + PATHS/ |
| 132 | + ... |
| 133 | + TRAINS/ |
| 134 | + CONSISTS/ |
| 135 | + ... |
| 136 | + |
| 137 | + =Surfliner2.zip= |
| 138 | + MSTS/ |
| 139 | + ROUTES/ |
| 140 | + Surfliner2/ |
| 141 | + ... |
| 142 | + |
| 143 | +## Paths and References |
| 144 | +Files in a package can contain references to files in the same or other packages. For example: |
| 145 | + |
| 146 | + /OR/SomePackage/Shapes/bungalow.s |
| 147 | + |
| 148 | +refers to file |
| 149 | + |
| 150 | + C:\Users\Ryan\Open Rails\SomePackage.zip\SomePackage\Shapes\bungalow.s |
| 151 | + |
| 152 | +Files in the MSTS-organised packages can continue to use legacy references such as: |
| 153 | + |
| 154 | + ..\..\SomePackage\Shapes\bungalow.s |
| 155 | + |
| 156 | +but files in the OR-organised packages must start from the /OR root and may not use ".." |
| 157 | + |
| 158 | + |
| 159 | +### For OR assets that are inextricably linked with other assets (paths and activities vis-a-vis routes) |
| 160 | +An activity must be linked to a route. In OR packages, this will be achieved with a more restrictive reference: |
| 161 | + |
| 162 | + "Route": "/OR/SomePackage/Routes/SomeRoute.route-or" |
0 commit comments