Skip to content

Commit

Permalink
libdoomsday: ‘-file’ paths are populated under “/sys/cmdline/“
Browse files Browse the repository at this point in the history
This makes the native files specified as parameters of ‘-file’
available via FS2. In practice, they are (potentially) recognized
as data bundles and then marked as packages to load by default (todo).
  • Loading branch information
skyjake committed Jan 6, 2017
1 parent 342277d commit 464401e
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions doomsday/apps/libdoomsday/src/doomsdayapp.cpp
Expand Up @@ -37,12 +37,13 @@
#include "doomsday/GameStateFolder"

#include <de/App>
#include <de/Config>
#include <de/CommandLine>
#include <de/Config>
#include <de/DictionaryValue>
#include <de/DirectoryFeed>
#include <de/Folder>
#include <de/Loop>
#include <de/NativeFile>
#include <de/PackageLoader>
#include <de/ScriptSystem>
#include <de/c_wrapper.h>
Expand Down Expand Up @@ -192,6 +193,19 @@ DENG2_PIMPL(DoomsdayApp)
}
}

void initCommandLineFiles(String const &option)
{
FileSystem::get().makeFolder("/sys/cmdline", FS::DontInheritFeeds);

CommandLine::get().forAllParameters(option, [] (duint pos, String const &)
{
auto &cmdLine = CommandLine::get();
cmdLine.makeAbsolutePath(pos);
DirectoryFeed::manuallyPopulateSingleFile(cmdLine.at(pos),
FS::get().makeFolder(String("/sys/cmdline/arg%1").arg(pos, 3, 10, QChar('0'))));
});
}

/**
* Doomsday can locate WAD files from various places. This method attaches
* a set of feeds to /local/wads/ so that all the native folders where the
Expand All @@ -200,7 +214,7 @@ DENG2_PIMPL(DoomsdayApp)
void initWadFolders()
{
// "/local" is for various files on the local computer.
Folder &wads = App::fileSystem().makeFolder(PATH_LOCAL_WADS, FS::DontInheritFeeds);
Folder &wads = FileSystem::get().makeFolder(PATH_LOCAL_WADS, FS::DontInheritFeeds);
wads.clear();
wads.clearFeeds();

Expand Down Expand Up @@ -300,7 +314,7 @@ DENG2_PIMPL(DoomsdayApp)

void initPackageFolders()
{
Folder &packs = App::fileSystem().makeFolder(PATH_LOCAL_PACKS, FS::DontInheritFeeds);
Folder &packs = FileSystem::get().makeFolder(PATH_LOCAL_PACKS, FS::DontInheritFeeds);
packs.clear();
packs.clearFeeds();

Expand Down Expand Up @@ -400,16 +414,16 @@ DoomsdayApp::DoomsdayApp(Players::Constructor playerConstructor)
static GameStateFolder::Interpreter intrpGameStateFolder;
static DataBundle::Interpreter intrpDataBundle;

App::fileSystem().addInterpreter(intrpGameStateFolder);
App::fileSystem().addInterpreter(intrpDataBundle);
FileSystem::get().addInterpreter(intrpGameStateFolder);
FileSystem::get().addInterpreter(intrpDataBundle);
}

DoomsdayApp::~DoomsdayApp()
{}

void DoomsdayApp::initialize()
{
auto &fs = App::fileSystem();
auto &fs = FileSystem::get();

// Folder for temporary native files.
NativePath tmpPath = NativePath(QStandardPaths::writableLocation(QStandardPaths::TempLocation))
Expand All @@ -428,6 +442,7 @@ void DoomsdayApp::initialize()
fs.makeFolder("/sys/bundles", FS::DontInheritFeeds)
.attach(new res::BundleLinkFeed); // prunes expired symlinks

d->initCommandLineFiles("-file");
d->initWadFolders();
d->initPackageFolders();

Expand Down

0 comments on commit 464401e

Please sign in to comment.