/
app.cpp
836 lines (697 loc) · 21.6 KB
/
app.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
/*
* The Doomsday Engine Project -- libcore
*
* Copyright © 2010-2017 Jaakko Keränen <jaakko.keranen@iki.fi>
*
* @par License
* LGPL: http://www.gnu.org/licenses/lgpl.html
*
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details. You should have received a copy of
* the GNU Lesser General Public License along with this program; if not, see:
* http://www.gnu.org/licenses</small>
*/
#include "de/Animation"
#include "de/App"
#include "de/ArchiveFeed"
#include "de/ArchiveFolder"
#include "de/ArrayValue"
#include "de/Block"
#include "de/CommandLine"
#include "de/Config"
#include "de/DictionaryValue"
#include "de/DirectoryFeed"
#include "de/EscapeParser"
#include "de/FileLogSink"
#include "de/FileSystem"
#include "de/LibraryFile"
#include "de/Log"
#include "de/LogBuffer"
#include "de/LogFilter"
#include "de/math.h"
#include "de/MetadataBank"
#include "de/Module"
#include "de/NativeFile"
#include "de/NumberValue"
#include "de/PackageFeed"
#include "de/PackageLoader"
#include "de/Record"
#include "de/ScriptSystem"
#include "de/UnixInfo"
#include "de/Version"
#include "de/Writer"
#include "de/ZipArchive"
#include <QDir>
#include <QThread>
namespace de {
static App *singletonApp;
DENG2_PIMPL(App)
, DENG2_OBSERVES(PackageLoader, Activity)
{
QThread *mainThread;
/// Name of the application (metadata for humans).
String appName;
CommandLine cmdLine;
LogFilter logFilter;
LogBuffer logBuffer;
/// Path of the application executable.
NativePath appPath;
String unixHomeFolder;
NativePath cachedBasePath;
NativePath cachedPluginBinaryPath;
NativePath cachedHomePath;
/// Primary (wall) clock.
Clock clock;
/// Subsystems (not owned).
QList<System *> systems;
ScriptSystem scriptSys;
FileSystem fs;
std::unique_ptr<MetadataBank> metaBank;
std::unique_ptr<NativeFile> basePackFile;
Record appModule;
/// Archive where persistent data should be stored. Written to /home/persist.pack.
/// The archive is owned by the file system.
Archive *persistentData;
std::unique_ptr<UnixInfo> unixInfo;
/// The configuration.
Path configPath;
Config *config;
StringList packagesToLoadAtInit;
PackageLoader packageLoader;
void (*terminateFunc)(char const *);
/// Optional sink for warnings and errors (set with "-errors").
std::unique_ptr<FileLogSink> errorSink;
Impl(Public *a, QStringList args)
: Base(a)
, appName("Doomsday Engine")
, cmdLine(args)
, unixHomeFolder(".doomsday")
, persistentData(0)
, configPath("/packs/net.dengine.stdlib/modules/Config.de")
, config(0)
, terminateFunc(0)
{
packagesToLoadAtInit << "net.dengine.stdlib";
singletonApp = a;
mainThread = QThread::currentThread();
logBuffer.setEntryFilter(&logFilter);
Clock::setAppClock(&clock);
Animation::setClock(&clock);
qsrand(Time().asDateTime().toTime_t());
// Built-in systems.
systems << &fs << &scriptSys;
// Built-in file interpreters.
static LibraryFile::Interpreter intrpLibraryFile;
static ZipArchive::Interpreter intrpZipArchive;
fs.addInterpreter(intrpLibraryFile);
fs.addInterpreter(intrpZipArchive);
// Native App module.
scriptSys.addNativeModule("App", appModule);
}
~Impl()
{
metaBank.reset();
if (errorSink)
{
logBuffer.removeSink(*errorSink);
}
if (config)
{
// Update the log filter in the persistent configuration.
Record *filter = new Record;
logFilter.write(*filter);
config->objectNamespace().add("log.filter", filter);
delete config;
}
Clock::setAppClock(0);
logBuffer.setOutputFile("");
}
NativePath defaultNativeModulePath() const
{
#ifdef WIN32
NativePath appDir = appPath.fileNamePath();
return appDir / "..\\modules";
#else
return self().nativeBasePath() / "modules";
#endif
}
void initFileSystem(bool allowPlugins)
{
// Executables.
Folder &binFolder = fs.makeFolder("/bin");
// Initialize the built-in folders. This hooks up the default native
// directories into the appropriate places in the file system.
// All of these are in read-only mode.
if (ZipArchive::recognize(self().nativeBasePath()))
{
// As a special case, if the base path points to a resource pack,
// use the contents of the pack as the root of the file system.
// The pack itself does not appear in the file system.
basePackFile.reset(NativeFile::newStandalone(self().nativeBasePath()));
fs.root().attach(new ArchiveFeed(*basePackFile));
}
else
{
#ifdef MACOSX
NativePath appDir = appPath.fileNamePath();
binFolder.attach(new DirectoryFeed(appDir));
fs.makeFolder("/data").attach(new DirectoryFeed(self().nativeBasePath()));
#elif WIN32
NativePath appDir = appPath.fileNamePath();
fs.makeFolder("/data").attach(new DirectoryFeed(appDir / "..\\data"));
#else // UNIX
if ((self().nativeBasePath() / "data").exists())
{
fs.makeFolder("/data").attach(new DirectoryFeed(self().nativeBasePath() / "data"));
}
else
{
fs.makeFolder("/data").attach(new DirectoryFeed(self().nativeBasePath()));
}
#endif
if (defaultNativeModulePath().exists())
{
fs.makeFolder("/modules").attach(new DirectoryFeed(defaultNativeModulePath()));
}
}
if (allowPlugins)
{
binFolder.attach(new DirectoryFeed(self().nativePluginBinaryPath()));
}
// User's home folder.
fs.makeFolder("/home", FS::DontInheritFeeds).attach(new DirectoryFeed(self().nativeHomePath(),
DirectoryFeed::AllowWrite | DirectoryFeed::CreateIfMissing | DirectoryFeed::DefaultFlags));
// Loaded packages (as links).
fs.makeFolder("/packs").attach(new PackageFeed(packageLoader));
// Internal data (for runtime use only, thus writable).
fs.makeFolder("/sys").setMode(File::Write);
// Metadata for files.
metaBank.reset(new MetadataBank);
// Populate the file system.
fs.refresh();
Folder::waitForPopulation();
packageLoader.audienceForActivity() += this;
}
void setLogLevelAccordingToOptions()
{
// Override the log message level.
if (cmdLine.has("-loglevel") || cmdLine.has("-verbose") || cmdLine.has("-v") ||
cmdLine.has("-vv") || cmdLine.has("-vvv"))
{
LogEntry::Level level = LogEntry::Message;
try
{
int pos;
if ((pos = cmdLine.check("-loglevel", 1)) > 0)
{
level = LogEntry::textToLevel(cmdLine.at(pos + 1));
}
}
catch (Error const &er)
{
qWarning("%s", er.asText().toLatin1().constData());
}
// Aliases have not been defined at this point, so check all variants.
level = LogEntry::Level(level
- cmdLine.has("-verbose")
- cmdLine.has("-v")
- cmdLine.has("-vv") * 2
- cmdLine.has("-vvv") * 3);
if (level < LogEntry::XVerbose)
{
// Even more verbosity requested, so enable dev messages, too.
logFilter.setAllowDev(LogEntry::AllDomains, true);
level = LogEntry::XVerbose;
}
logFilter.setMinLevel(LogEntry::AllDomains, level);
}
// Enable developer messages across the board?
if (cmdLine.has("-devlog"))
{
logFilter.setAllowDev(LogEntry::AllDomains, true);
}
if (cmdLine.has("-nodevlog"))
{
logFilter.setAllowDev(LogEntry::AllDomains, false);
}
}
void checkForErrorDumpFile()
{
if (CommandLine::ArgWithParams arg = cmdLine.check("-errors", 1))
{
File &errors = self().rootFolder().replaceFile(Path("/home") / arg.params.at(0));
errorSink.reset(new FileLogSink(errors));
errorSink->setMode(LogSink::OnlyWarningEntries);
logBuffer.addSink(*errorSink);
}
}
ArchiveFolder &persistPackFolder()
{
return self().homeFolder().locate<ArchiveFolder>("persist.pack");
}
void setOfLoadedPackagesChanged()
{
// Make sure the package links are up to date.
fs.root().locate<Folder>("/packs").populate();
}
Record const *findAsset(String const &identifier) const
{
// Access the package that has this asset via a link.
Folder const *pkg = fs.root().tryLocate<Folder>("/packs/asset." + identifier + "/.");
if (!pkg) return 0;
// Find the record that has this asset's metadata.
String const ns = "package." + identifier;
if (pkg->objectNamespace().has(ns))
{
return &(*pkg)[ns].valueAsRecord();
}
return nullptr;
}
DENG2_PIMPL_AUDIENCE(StartupComplete)
};
DENG2_AUDIENCE_METHOD(App, StartupComplete)
App::App(NativePath const &appFilePath, QStringList args)
: d(new Impl(this, args))
{
d->unixInfo.reset(new UnixInfo);
// Global time source for animations.
Animation::setClock(&d->clock);
// This instance of LogBuffer is used globally.
LogBuffer::setAppBuffer(d->logBuffer);
// Do not flush the log buffer until we've found out where messages should
// be flushed (Config.log.file).
d->logBuffer.enableFlushing(false);
if (d->cmdLine.has("-stdout"))
{
// Standard output can be flushed straight away.
d->logBuffer.enableStandardOutput(true);
d->logBuffer.enableFlushing(true);
}
// The log filter will be read from Config, but until that time we can use
// the options from the command line.
d->setLogLevelAccordingToOptions();
d->appPath = appFilePath;
LOG_NOTE("Application path: ") << d->appPath;
LOG_NOTE("Build: ") << Version::currentBuild().asHumanReadableText();
#ifdef MACOSX
// When the application is started through Finder, we get a special command
// line argument. The working directory needs to be changed.
if (d->cmdLine.count() >= 2 && d->cmdLine.at(1).beginsWith("-psn"))
{
DirectoryFeed::changeWorkingDir(d->cmdLine.at(0).fileNamePath() + "/..");
}
#endif
}
App::~App()
{
LOG_AS("~App");
d.reset();
singletonApp = 0;
}
void App::addInitPackage(String const &identifier)
{
d->packagesToLoadAtInit << identifier;
}
void App::setConfigScript(Path const &path)
{
d->configPath = path;
}
void App::setName(String const &appName)
{
d->appName = appName;
}
void App::setUnixHomeFolderName(String const &name)
{
d->unixHomeFolder = name;
// Reload Unix config files.
d->unixInfo.reset(new UnixInfo);
}
String App::unixHomeFolderName() const
{
return d->unixHomeFolder;
}
String App::unixEtcFolderName() const
{
if (d->unixHomeFolder.startsWith("."))
{
return d->unixHomeFolder.mid(1);
}
return d->unixHomeFolder;
}
void App::setTerminateFunc(void (*func)(char const *))
{
d->terminateFunc = func;
}
void App::handleUncaughtException(String message)
{
LOG_CRITICAL(message);
EscapeParser esc;
esc.parse(message);
if (d->terminateFunc) d->terminateFunc(esc.plainText().toUtf8());
}
bool App::processEvent(Event const &ev)
{
foreach (System *sys, d->systems)
{
if (sys->behavior() & System::ReceivesInputEvents)
{
if (sys->processEvent(ev))
return true;
}
}
return false;
}
void App::timeChanged(Clock const &clock)
{
foreach (System *sys, d->systems)
{
if (sys->behavior() & System::ObservesTime)
{
sys->timeChanged(clock);
}
}
}
bool App::inMainThread()
{
if (!App::appExists())
{
// No app even created yet, must be main thread.
return true;
}
return DENG2_APP->d->mainThread == QThread::currentThread();
}
NativePath App::nativePluginBinaryPath()
{
if (!d->cachedPluginBinaryPath.isEmpty()) return d->cachedPluginBinaryPath;
if (auto const opt = d->cmdLine.check("-libdir", 1))
{
d->cmdLine.makeAbsolutePath(opt.pos + 1);
return (d->cachedPluginBinaryPath = d->cmdLine.at(opt.pos + 1));
}
NativePath path;
#ifdef WIN32
path = d->appPath.fileNamePath() / "plugins";
#else
# ifdef MACOSX
path = d->appPath.fileNamePath() / "../PlugIns/Doomsday";
# else
path = DENG_LIBRARY_DIR;
if (!path.exists())
{
// Try a fallback relative to the executable.
path = d->appPath.fileNamePath() / "../lib/doomsday";
}
# endif
// Also check the system config files.
d->unixInfo->path("libdir", path);
#endif
return (d->cachedPluginBinaryPath = path);
}
NativePath App::nativeHomePath()
{
if (!d->cachedHomePath.isEmpty()) return d->cachedHomePath;
if (auto const opt = d->cmdLine.check("-userdir", 1))
{
d->cmdLine.makeAbsolutePath(opt.pos + 1);
return (d->cachedHomePath = d->cmdLine.at(opt.pos + 1));
}
#ifdef MACOSX
NativePath nativeHome = QDir::homePath();
nativeHome = nativeHome / "Library/Application Support" / d->appName / "runtime";
#elif WIN32
NativePath nativeHome = appDataPath();
nativeHome = nativeHome / "runtime";
#else // UNIX
NativePath nativeHome = QDir::homePath();
nativeHome = nativeHome / d->unixHomeFolder / "runtime";
#endif
return (d->cachedHomePath = nativeHome);
}
Archive const &App::persistentData()
{
Archive const *persist = DENG2_APP->d->persistentData;
if (!persist)
{
throw PersistentDataNotAvailable("App::persistentData", "Persistent data is disabled");
}
return *persist;
}
Archive &App::mutablePersistentData()
{
Archive *persist = DENG2_APP->d->persistentData;
if (!persist)
{
throw PersistentDataNotAvailable("App::mutablePersistentData", "Persistent data is disabled");
}
return *persist;
}
bool App::hasPersistentData()
{
return DENG2_APP->d->persistentData != 0;
}
ArchiveFolder &App::persistPackFolder()
{
return DENG2_APP->d->persistPackFolder();
}
NativePath App::currentWorkPath()
{
return NativePath::workPath();
}
bool App::setCurrentWorkPath(NativePath const &cwd)
{
return NativePath::setWorkPath(cwd);
}
NativePath App::nativeBasePath()
{
if (!d->cachedBasePath.isEmpty()) return d->cachedBasePath;
int i;
if ((i = d->cmdLine.check("-basedir", 1)))
{
d->cmdLine.makeAbsolutePath(i + 1);
return (d->cachedBasePath = d->cmdLine.at(i + 1));
}
NativePath path;
#ifdef WIN32
path = d->appPath.fileNamePath() / "..";
#else
# ifdef MACOSX
path = d->appPath.fileNamePath() / "../Resources";
if (!path.exists())
{
// Try the built-in base directory (unbundled apps).
path = DENG_BASE_DIR;
}
# else
path = DENG_BASE_DIR;
# endif
if (!path.exists())
{
// Fall back to using the application binary path, which always exists.
// We use this instead of the working directory because the basedir is
// meant for storing read-only data files that may be deployed with
// the application binary.
path = d->appPath.fileNamePath();
}
// Also check the system config files.
d->unixInfo->path("basedir", path);
#endif
return (d->cachedBasePath = path);
}
void App::initSubsystems(SubsystemInitFlags flags)
{
bool allowPlugins = !flags.testFlag(DisablePlugins);
d->initFileSystem(allowPlugins);
// Load the init packages.
foreach (String pkg, d->packagesToLoadAtInit)
{
d->packageLoader.load(pkg);
}
if (!flags.testFlag(DisablePersistentData))
{
// Recreate the persistent state data package, if necessary.
if (!homeFolder().has("persist.pack") || commandLine().has("-reset"))
{
ZipArchive arch;
arch.add("Info", String(QString("# Package for %1's persistent state.\n").arg(d->appName)).toUtf8());
File &persistPack = homeFolder().replaceFile("persist.pack");
Writer(persistPack) << arch;
persistPack.reinterpret()->as<ArchiveFolder>().populate();
}
// Load the persistent data.
d->persistentData = &d->persistPackFolder().archive();
}
// The configuration.
d->config = new Config(d->configPath);
d->scriptSys.addNativeModule("Config", d->config->objectNamespace());
d->config->read();
// Immediately after upgrading, OLD_VERSION is also present in the Version module.
Version oldVer = d->config->upgradedFromVersion();
if (oldVer != Version::currentBuild())
{
ArrayValue *old = new ArrayValue;
*old << NumberValue(oldVer.major) << NumberValue(oldVer.minor)
<< NumberValue(oldVer.patch) << NumberValue(oldVer.build);
d->scriptSys.nativeModule("Version").addArray("OLD_VERSION", old).setReadOnly();
}
// Set up the log buffer.
LogBuffer &logBuf = LogBuffer::get();
// Update the log buffer max entry count: number of items to hold in memory.
logBuf.setMaxEntryCount(d->config->getui("log.bufferSize", 1000));
try
{
// The -out option can be used to override the configured output file.
if (CommandLine::ArgWithParams outArg = commandLine().check("-out", 1))
{
logBuf.setOutputFile(String("/home") / outArg.params.at(0));
}
else if (d->config->has("log"))
{
// Set the log output file.
logBuf.setOutputFile(d->config->gets("log.file"));
}
}
catch (Error const &er)
{
LOG_WARNING("Failed to set log output file:\n" + er.asText());
}
// Check if a separate error output file is requested.
d->checkForErrorDumpFile();
try
{
if (d->config->has("log.filter"))
{
// The level of enabled messages.
d->logFilter.read(d->config->subrecord("log.filter"));
}
}
catch (Error const &er)
{
LOG_WARNING("Failed to apply log filter:\n" + er.asText());
}
// Command line options may override the saved config.
d->setLogLevelAccordingToOptions();
LOGDEV_NOTE("Developer log entries enabled");
// We can start flushing now when the destination is known.
logBuf.enableFlushing(true);
// Update the wall clock time.
d->clock.setTime(Time::currentHighPerformanceTime());
// Now we can start observing progress of time.
d->clock.audienceForTimeChange() += this;
if (allowPlugins)
{
#if 0 // not yet handled by libcore
// Load the basic plugins.
loadPlugins();
#endif
}
LOG_VERBOSE("libcore::App %s subsystems initialized") << Version::currentBuild().asHumanReadableText();
}
void App::addSystem(System &system)
{
d->systems.removeAll(&system);
d->systems.append(&system);
}
void App::removeSystem(System &system)
{
d->systems.removeAll(&system);
}
void App::notifyStartupComplete()
{
DENG2_FOR_AUDIENCE2(StartupComplete, i)
{
i->appStartupCompleted();
}
}
bool App::appExists()
{
return singletonApp != 0;
}
App &App::app()
{
DENG2_ASSERT(appExists());
return *singletonApp;
}
LogFilter &App::logFilter()
{
return DENG2_APP->d->logFilter;
}
CommandLine &App::commandLine()
{
return DENG2_APP->d->cmdLine;
}
NativePath App::executablePath()
{
return DENG2_APP->d->appPath;
}
#ifdef MACOSX
NativePath App::nativeAppContentsPath()
{
return DENG2_APP->d->appPath/"../..";
}
#endif
FileSystem &App::fileSystem()
{
return DENG2_APP->d->fs;
}
MetadataBank &App::metadataBank()
{
DENG2_ASSERT(DENG2_APP->d->metaBank);
return *DENG2_APP->d->metaBank;
}
PackageLoader &App::packageLoader()
{
return DENG2_APP->d->packageLoader;
}
int App::findInPackages(String const &partialPath, FS::FoundFiles &files)
{
return App::fileSystem().nameIndex().findPartialPathInPackageOrder(partialPath, files);
}
bool App::assetExists(String const &identifier)
{
return DENG2_APP->d->findAsset(identifier) != 0;
}
Package::Asset App::asset(String const &identifier)
{
Record const *info = DENG2_APP->d->findAsset(identifier);
if (!info)
{
throw AssetNotFoundError("App::asset", "Asset \"" + identifier +
"\" does not exist");
}
return *info;
}
ScriptSystem &App::scriptSystem()
{
return DENG2_APP->d->scriptSys;
}
bool App::configExists()
{
return DENG2_APP->d->config != nullptr;
}
Folder &App::rootFolder()
{
return fileSystem().root();
}
Folder &App::homeFolder()
{
return rootFolder().locate<Folder>("home");
}
Config &App::config()
{
DENG2_ASSERT(DENG2_APP->d->config != 0);
return *DENG2_APP->d->config;
}
Variable &App::config(String const &name)
{
return config()[name];
}
UnixInfo &App::unixInfo()
{
return *DENG2_APP->d->unixInfo;
}
} // namespace de