Module: Esp::Mw::DataFiles
- Defined in:
- lib/esp/mw/data_files.rb
Overview
Where Morrowind keeps its vanilla data files (‘Morrowind.esm` and friends, plus user-installed `.esp` plugins for the original engine). Engine-agnostic — OpenMW reads them via `data=` in openmw.cfg; the original engine reads them in place. The same set of probe paths serves both:
-
‘esp refs unpack` reads the vanilla ESMs out of here.
-
‘esp install –to-data-files` copies a built plugin into here so the original engine’s launcher picks it up.
Detection is best-effort, per-OS Steam/GOG defaults. Anything non-default is overridable via $MORROWIND_DATA or an explicit flag.
Class Method Summary collapse
- .candidates ⇒ Object
-
.default ⇒ Object
The first existing candidate, else the first candidate (so error messages can still name a reasonable path even when nothing’s installed).
-
.resolve(override: nil) ⇒ Object
Resolve the user’s intent: –data override beats $MORROWIND_DATA beats the per-OS default.
Class Method Details
.candidates ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/esp/mw/data_files.rb', line 17 def candidates home = Dir.home case Esp::Mw::OpenmwConfig.host_os when :macos then macos_candidates(home) when :windows then windows_candidates else linux_candidates(home) end end |
.default ⇒ Object
The first existing candidate, else the first candidate (so error messages can still name a reasonable path even when nothing’s installed).
29 30 31 |
# File 'lib/esp/mw/data_files.rb', line 29 def default candidates.find { |dir| File.directory?(dir) } || candidates.first end |
.resolve(override: nil) ⇒ Object
Resolve the user’s intent: –data override beats $MORROWIND_DATA beats the per-OS default. Returns the resolved path (no validation — the caller decides whether to error on a missing dir).
36 37 38 39 40 41 |
# File 'lib/esp/mw/data_files.rb', line 36 def resolve(override: nil) return override if override && !override.to_s.empty? return ENV['MORROWIND_DATA'] if ENV['MORROWIND_DATA'] && !ENV['MORROWIND_DATA'].empty? default end |