Skip to content

Commit

Permalink
libdoomsday|Client: Runtime path is managed by de::App, not libdoomsday
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Mar 20, 2016
1 parent 13996bd commit f4a2e3a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
6 changes: 3 additions & 3 deletions doomsday/apps/client/src/dd_main.cpp
Expand Up @@ -507,7 +507,7 @@ void App_Error(char const *error, ...)
errorInProgress = true;

// Get back to the directory we started from.
Dir_SetCurrent(DD_RuntimePath());
//Dir_SetCurrent(DD_RuntimePath());

va_start(argptr, error);
dd_vsnprintf(err, sizeof(err), error, argptr);
Expand Down Expand Up @@ -1246,10 +1246,10 @@ static dint DD_StartupWorker(void * /*context*/)
//Con_SetProgress(20);

// Was the change to userdir OK?
if(CommandLine_CheckWith("-userdir", 1) && !DoomsdayApp::app().isUsingUserDir())
/*if(CommandLine_CheckWith("-userdir", 1) && !DoomsdayApp::app().isUsingUserDir())
{
LOG_WARNING("User directory not found (check -userdir)");
}
}*/

FS_InitVirtualPathMappings();
App_FileSystem().resetAllSchemes();
Expand Down
6 changes: 3 additions & 3 deletions doomsday/apps/libdoomsday/include/doomsday/doomsdayapp.h
Expand Up @@ -103,7 +103,7 @@ class LIBDOOMSDAY_PUBLIC DoomsdayApp
std::function<int (void *)> gameActivationFunc,
Behaviors behaviors = DefaultBehavior);

bool isUsingUserDir() const;
//bool isUsingUserDir() const;

bool isShuttingDown() const;
void setShuttingDown(bool shuttingDown);
Expand All @@ -113,9 +113,9 @@ class LIBDOOMSDAY_PUBLIC DoomsdayApp
#endif

void setDoomsdayBasePath(de::NativePath const &path);
void setDoomsdayRuntimePath(de::NativePath const &path);
//void setDoomsdayRuntimePath(de::NativePath const &path);
std::string const &doomsdayBasePath() const;
std::string const &doomsdayRuntimePath() const;
//std::string const &doomsdayRuntimePath() const;

public:
static DoomsdayApp &app();
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/libdoomsday/include/doomsday/paths.h
Expand Up @@ -27,11 +27,11 @@ extern "C" {

LIBDOOMSDAY_PUBLIC char const *DD_BasePath();

LIBDOOMSDAY_PUBLIC char const *DD_RuntimePath();
//LIBDOOMSDAY_PUBLIC char const *DD_RuntimePath();

LIBDOOMSDAY_PUBLIC void DD_SetBasePath(char const *path);

LIBDOOMSDAY_PUBLIC void DD_SetRuntimePath(char const *path);
//LIBDOOMSDAY_PUBLIC void DD_SetRuntimePath(char const *path);

#ifdef __cplusplus
} // extern "C"
Expand Down
26 changes: 15 additions & 11 deletions doomsday/apps/libdoomsday/src/doomsdayapp.cpp
Expand Up @@ -66,7 +66,7 @@ static DoomsdayApp *theDoomsdayApp = nullptr;
DENG2_PIMPL(DoomsdayApp)
{
std::string ddBasePath; // Doomsday root directory is at...?
std::string ddRuntimePath;
//std::string ddRuntimePath;

bool initialized = false;
bool shuttingDown = false;
Expand All @@ -78,15 +78,15 @@ DENG2_PIMPL(DoomsdayApp)
Players players;
res::Bundles dataBundles;

/// @c true = We are using a custom user dir specified on the command line.
bool usingUserDir = false;
// @c true = We are using a custom user dir specified on the command line.
//bool usingUserDir = false;

#ifdef UNIX
/*#ifdef UNIX
# ifndef MACOSX
/// @c true = We are using the user dir defined in the HOME environment.
bool usingHomeDir = false;
# endif
#endif
#endif*/

#ifdef WIN32
HINSTANCE hInstance = NULL;
Expand Down Expand Up @@ -253,6 +253,7 @@ DENG2_PIMPL(DoomsdayApp)
// By default, make sure the working path is the home folder.
App::setCurrentWorkPath(App::app().nativeHomePath());

/*
# ifndef MACOSX
if(getenv("HOME"))
{
Expand All @@ -270,7 +271,8 @@ DENG2_PIMPL(DoomsdayApp)
Dir_Delete(temp);
}
# endif

*/
/*
// The -userdir option sets the working directory.
if(CommandLine_CheckWith("-userdir", 1))
{
Expand Down Expand Up @@ -304,7 +306,7 @@ DENG2_PIMPL(DoomsdayApp)
directory_t* temp = Dir_NewFromCWD();
DD_SetRuntimePath(Dir_Path(temp));
Dir_Delete(temp);
}
}*/

// libcore has determined the native base path, so let FS1 know about it.
DD_SetBasePath(DENG2_APP->nativeBasePath().toUtf8());
Expand All @@ -314,6 +316,7 @@ DENG2_PIMPL(DoomsdayApp)
#ifdef WIN32
void determineGlobalPaths()
{
/*
// Change to a custom working directory?
if(CommandLine_CheckWith("-userdir", 1))
{
Expand All @@ -326,6 +329,7 @@ DENG2_PIMPL(DoomsdayApp)
// The runtime directory is the current working directory.
DD_SetRuntimePath((NativePath::workPath().withSeparators('/') + '/').toUtf8().constData());
*/

// Use a custom base directory?
if(CommandLine_CheckWith("-basedir", 1))
Expand Down Expand Up @@ -470,10 +474,10 @@ NativePath DoomsdayApp::steamBasePath()
return "";
}

bool DoomsdayApp::isUsingUserDir() const
/*bool DoomsdayApp::isUsingUserDir() const
{
return d->usingUserDir;
}
}*/

bool DoomsdayApp::isShuttingDown() const
{
Expand Down Expand Up @@ -506,15 +510,15 @@ void DoomsdayApp::setDoomsdayBasePath(NativePath const &path)
d->ddBasePath = temp;
}

std::string const &DoomsdayApp::doomsdayRuntimePath() const
/*std::string const &DoomsdayApp::doomsdayRuntimePath() const
{
return d->ddRuntimePath;
}
void DoomsdayApp::setDoomsdayRuntimePath(NativePath const &path)
{
d->ddRuntimePath = path.toUtf8().constData();
}
}*/

#ifdef WIN32
void *DoomsdayApp::moduleHandle() const
Expand Down
8 changes: 4 additions & 4 deletions doomsday/apps/libdoomsday/src/paths.cpp
Expand Up @@ -24,17 +24,17 @@ char const *DD_BasePath()
return DoomsdayApp::app().doomsdayBasePath().c_str();
}

char const *DD_RuntimePath()
/*char const *DD_RuntimePath()
{
return DoomsdayApp::app().doomsdayRuntimePath().c_str();
}
}*/

void DD_SetBasePath(char const *path)
{
DoomsdayApp::app().setDoomsdayBasePath(path);
}

void DD_SetRuntimePath(char const *path)
/*void DD_SetRuntimePath(char const *path)
{
DoomsdayApp::app().setDoomsdayRuntimePath(path);
}
}*/

0 comments on commit f4a2e3a

Please sign in to comment.