wip
parent
803afffce6
commit
c4e426d70b
|
@ -622,7 +622,7 @@ path current_path(std::error_code& ec)
|
|||
return buffer.substr(0, pos);
|
||||
#else
|
||||
std::string buffer(256, 0);
|
||||
char *r = getcwd(&buffer[0], p.size());
|
||||
char *r = getcwd(&buffer[0], buffer.size());
|
||||
if (r == nullptr)
|
||||
{
|
||||
ec = std::error_code(errno, std::system_category());
|
||||
|
|
|
@ -1916,6 +1916,10 @@ void CelestiaCore::setStartURL(const string &url)
|
|||
}
|
||||
}
|
||||
|
||||
std::string_view CelestiaCore::getStartURL() const
|
||||
{
|
||||
return startURL;
|
||||
}
|
||||
|
||||
void CelestiaCore::tick()
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <celutil/timer.h>
|
||||
#include <celutil/watcher.h>
|
||||
// #include <celutil/watchable.h>
|
||||
#include <celcompat/string_view.h>
|
||||
#include <celengine/solarsys.h>
|
||||
#include <celengine/overlay.h>
|
||||
#include <celengine/texture.h>
|
||||
|
@ -206,6 +207,7 @@ class CelestiaCore // : public Watchable<CelestiaCore>
|
|||
|
||||
// URLs and history navigation
|
||||
void setStartURL(const std::string& url);
|
||||
std::string_view getStartURL() const;
|
||||
bool goToUrl(const std::string& urlStr);
|
||||
void addToHistory();
|
||||
void back();
|
||||
|
|
|
@ -3058,7 +3058,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
// If there's an existing instance and we've been given a
|
||||
// URL on the command line, send the URL to the running instance
|
||||
// of Celestia before terminating.
|
||||
if (startURL != "")
|
||||
auto startURL = appCore.getStartURL();
|
||||
if (!startURL().empty())
|
||||
{
|
||||
COPYDATASTRUCT cd;
|
||||
cd.dwData = 0;
|
||||
|
@ -3072,11 +3073,6 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
}
|
||||
}
|
||||
|
||||
// If a start directory was given on the command line, switch to it
|
||||
// now.
|
||||
if (startDirectory != "")
|
||||
SetCurrentDirectory(startDirectory.c_str());
|
||||
|
||||
s_splash = new SplashWindow(SPLASH_DIR "\\" "splash.png");
|
||||
s_splash->setMessage(_("Loading data files..."));
|
||||
if (!skipSplashScreen)
|
||||
|
@ -3191,8 +3187,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
if (!skipSplashScreen)
|
||||
progressNotifier = new WinSplashProgressNotifier(s_splash);
|
||||
|
||||
bool initSucceeded = appCore->initSimulation(configFileName, extrasDirectories, progressNotifier);
|
||||
|
||||
bool initSucceeded = appCore->initSimulation(progressNotifier);
|
||||
delete progressNotifier;
|
||||
|
||||
// Close the splash screen after all data has been loaded
|
||||
|
@ -3207,9 +3202,6 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
if (!initSucceeded)
|
||||
return 1;
|
||||
|
||||
if (startURL != "")
|
||||
appCore->setStartURL(startURL);
|
||||
|
||||
menuBar = CreateMenuBar();
|
||||
acceleratorTable = LoadAccelerators(hRes,
|
||||
MAKEINTRESOURCE(IDR_ACCELERATORS));
|
||||
|
@ -3373,15 +3365,6 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
|
||||
appCore->start();
|
||||
|
||||
if (startURL != "")
|
||||
{
|
||||
COPYDATASTRUCT cd;
|
||||
cd.dwData = 0;
|
||||
cd.cbData = startURL.length();
|
||||
cd.lpData = reinterpret_cast<void*>(const_cast<char*>(startURL.c_str()));
|
||||
SendMessage(mainWindow, WM_COPYDATA, 0, reinterpret_cast<LPARAM>(&cd));
|
||||
}
|
||||
|
||||
// Initial tick required before first frame is rendered; this gives
|
||||
// start up scripts a chance to run.
|
||||
appCore->tick();
|
||||
|
|
Loading…
Reference in New Issue