mirror of https://github.com/stella-emu/stella.git
Remove 'HomeFinder' from various parts of code, restrict to Win-specific
class.
This commit is contained in:
parent
3419b3f7fb
commit
a4b4cc62b6
|
@ -23,8 +23,6 @@
|
|||
#endif
|
||||
#elif defined(BSPF_WINDOWS)
|
||||
#define ROOT_DIR "C:\\"
|
||||
#include "HomeFinder.hxx"
|
||||
static HomeFinder ourHomeFinder;
|
||||
#else
|
||||
#define ROOT_DIR ""
|
||||
#endif
|
||||
|
@ -45,11 +43,7 @@ FSNodeREGULAR::FSNodeREGULAR(const string& path, bool verify)
|
|||
// Expand '~' to the HOME environment variable
|
||||
if (_path[0] == '~')
|
||||
{
|
||||
#if defined(BSPF_WINDOWS)
|
||||
const char* home = ourHomeFinder.getHomePath().c_str();
|
||||
#else
|
||||
const char* home = std::getenv("HOME");
|
||||
#endif
|
||||
if (home != nullptr)
|
||||
_path.replace(0, 1, home);
|
||||
}
|
||||
|
@ -100,11 +94,7 @@ void FSNodeREGULAR::setFlags()
|
|||
string FSNodeREGULAR::getShortPath() const
|
||||
{
|
||||
// If the path starts with the home directory, replace it with '~'
|
||||
#if defined(BSPF_WINDOWS)
|
||||
const char* env_home = ourHomeFinder.getHomePath().c_str();
|
||||
#else
|
||||
const char* env_home = std::getenv("HOME");
|
||||
#endif
|
||||
const string& home = env_home != nullptr ? env_home : EmptyString;
|
||||
|
||||
if (home != EmptyString && BSPF::startsWithIgnoreCase(_path, home))
|
||||
|
|
|
@ -25,11 +25,6 @@
|
|||
#include "FSNodeFactory.hxx"
|
||||
#include "FSNodeZIP.hxx"
|
||||
|
||||
#if defined(BSPF_WINDOWS)
|
||||
#include "HomeFinder.hxx"
|
||||
static HomeFinder ourHomeFinder;
|
||||
#endif
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
FSNodeZIP::FSNodeZIP(const string& p)
|
||||
{
|
||||
|
@ -43,13 +38,9 @@ FSNodeZIP::FSNodeZIP(const string& p)
|
|||
// Expand '~' to the users 'home' directory
|
||||
if (_zipFile[0] == '~')
|
||||
{
|
||||
#if defined(BSPF_UNIX) || defined(BSPF_MACOS)
|
||||
const char* home = std::getenv("HOME");
|
||||
if (home != nullptr)
|
||||
_zipFile.replace(0, 1, home);
|
||||
#elif defined(BSPF_WINDOWS)
|
||||
_zipFile.replace(0, 1, ourHomeFinder.getHomePath());
|
||||
#endif
|
||||
}
|
||||
|
||||
// cerr << " => p: " << p << endl;
|
||||
|
|
|
@ -284,17 +284,8 @@ void FileListWidget::reload()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const FSNode& FileListWidget::selected()
|
||||
{
|
||||
if(_fileList.size() > 0)
|
||||
{
|
||||
_selected = BSPF::clamp(_selected, 0U, static_cast<uInt32>(_fileList.size()-1));
|
||||
return _fileList[_selected];
|
||||
}
|
||||
else
|
||||
{
|
||||
// This should never happen, but we'll error-check out-of-bounds
|
||||
// array access anyway
|
||||
return ourDefaultNode;
|
||||
}
|
||||
_selected = BSPF::clamp(_selected, 0U, static_cast<uInt32>(_fileList.size()-1));
|
||||
return _fileList[_selected];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -727,6 +718,3 @@ string FileListWidget::getToolTip(const Common::Point& pos) const
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt64 FileListWidget::_QUICK_SELECT_DELAY = 300;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
FSNode FileListWidget::ourDefaultNode = FSNode("~");
|
||||
|
|
|
@ -187,8 +187,6 @@ class FileListWidget : public StringListWidget
|
|||
|
||||
unique_ptr<ProgressDialog> myProgressDialog;
|
||||
|
||||
static FSNode ourDefaultNode;
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
FileListWidget() = delete;
|
||||
|
|
|
@ -21,6 +21,15 @@
|
|||
|
||||
#include "OSystemWINDOWS.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystemWINDOWS::OSystemWINDOWS()
|
||||
{
|
||||
// Make sure 'HOME' environment variable exists; other parts of the
|
||||
// codebase depend on it
|
||||
HomeFinder homefinder;
|
||||
_putenv_s("HOME", homefinder.getHomePath().c_str());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystemWINDOWS::getBaseDirectories(string& basedir, string& homedir,
|
||||
bool useappdir, const string& usedir)
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
class OSystemWINDOWS : public OSystemStandalone
|
||||
{
|
||||
public:
|
||||
OSystemWINDOWS() = default;
|
||||
OSystemWINDOWS();
|
||||
~OSystemWINDOWS() override = default;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue