Refactored 'FilesystemNode' -> 'FSNode', in preparation for large overhaul of these classes.

This commit is contained in:
Stephen Anthony 2022-06-14 16:28:20 -02:30
parent 4af178bdd1
commit 4a2ed8f7d0
84 changed files with 434 additions and 440 deletions

View File

@ -38,7 +38,7 @@ class AbstractFSNode;
@author Stephen Anthony
*/
class FilesystemNodeFactory
class FSNodeFactory
{
public:
enum class Type { SYSTEM, ZIP };
@ -50,16 +50,16 @@ class FilesystemNodeFactory
{
case Type::SYSTEM:
#if defined(BSPF_UNIX) || defined(BSPF_MACOS)
return make_unique<FilesystemNodePOSIX>(path);
return make_unique<FSNodePOSIX>(path);
#elif defined(BSPF_WINDOWS)
return make_unique<FilesystemNodeWINDOWS>(path);
return make_unique<FSNodeWINDOWS>(path);
#elif defined(__LIB_RETRO__)
return make_unique<FilesystemNodeLIBRETRO>(path);
return make_unique<FSNodeLIBRETRO>(path);
#endif
break;
case Type::ZIP:
#if defined(ZIP_SUPPORT)
return make_unique<FilesystemNodeZIP>(path);
return make_unique<FSNodeZIP>(path);
#endif
break;
}
@ -68,11 +68,11 @@ class FilesystemNodeFactory
private:
// Following constructors and assignment operators not supported
FilesystemNodeFactory() = delete;
FilesystemNodeFactory(const FilesystemNodeFactory&) = delete;
FilesystemNodeFactory(FilesystemNodeFactory&&) = delete;
FilesystemNodeFactory& operator=(const FilesystemNodeFactory&) = delete;
FilesystemNodeFactory& operator=(FilesystemNodeFactory&&) = delete;
FSNodeFactory() = delete;
FSNodeFactory(const FSNodeFactory&) = delete;
FSNodeFactory(FSNodeFactory&&) = delete;
FSNodeFactory& operator=(const FSNodeFactory&) = delete;
FSNodeFactory& operator=(FSNodeFactory&&) = delete;
};
#endif

View File

@ -26,7 +26,7 @@
#include "FSNodeZIP.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeZIP::FilesystemNodeZIP(const string& p)
FSNodeZIP::FSNodeZIP(const string& p)
{
// Extract ZIP file and virtual file (if specified)
const size_t pos = BSPF::findIgnoreCase(p, ".zip");
@ -100,8 +100,8 @@ FilesystemNodeZIP::FilesystemNodeZIP(const string& p)
// has direct access to the actual filesystem (aka, a 'System' node)
// Behind the scenes, this node is actually a platform-specific object
// for whatever system we are running on
_realNode = FilesystemNodeFactory::create(_zipFile,
FilesystemNodeFactory::Type::SYSTEM);
_realNode = FSNodeFactory::create(_zipFile,
FSNodeFactory::Type::SYSTEM);
setFlags(_zipFile, _virtualPath, _realNode);
// cerr << "==============================================================\n";
@ -109,9 +109,8 @@ FilesystemNodeZIP::FilesystemNodeZIP(const string& p)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeZIP::FilesystemNodeZIP(
const string& zipfile, const string& virtualpath,
const AbstractFSNodePtr& realnode, size_t size, bool isdir)
FSNodeZIP::FSNodeZIP(const string& zipfile, const string& virtualpath,
const AbstractFSNodePtr& realnode, size_t size, bool isdir)
: _size{size},
_isDirectory{isdir},
_isFile{!isdir}
@ -121,9 +120,8 @@ FilesystemNodeZIP::FilesystemNodeZIP(
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FilesystemNodeZIP::setFlags(const string& zipfile,
const string& virtualpath,
const AbstractFSNodePtr& realnode)
void FSNodeZIP::setFlags(const string& zipfile, const string& virtualpath,
const AbstractFSNodePtr& realnode)
{
_zipFile = zipfile;
_virtualPath = virtualpath;
@ -147,7 +145,7 @@ void FilesystemNodeZIP::setFlags(const string& zipfile,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeZIP::exists() const
bool FSNodeZIP::exists() const
{
if(_realNode && _realNode->exists())
{
@ -172,7 +170,7 @@ bool FilesystemNodeZIP::exists() const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeZIP::getChildren(AbstractFSList& myList, ListMode mode) const
bool FSNodeZIP::getChildren(AbstractFSList& myList, ListMode mode) const
{
// Files within ZIP archives don't contain children
if(!isDirectory() || _error != zip_error::NONE)
@ -199,14 +197,14 @@ bool FilesystemNodeZIP::getChildren(AbstractFSList& myList, ListMode mode) const
if(pos != string::npos)
dirs.emplace(curr.substr(0, pos));
else
myList.emplace_back(new FilesystemNodeZIP(_zipFile, name, _realNode, size, false));
myList.emplace_back(new FSNodeZIP(_zipFile, name, _realNode, size, false));
}
}
for(const auto& dir: dirs)
{
// Prepend previous path
const string& vpath = _virtualPath != "" ? _virtualPath + "/" + dir : dir;
myList.emplace_back(new FilesystemNodeZIP(_zipFile, vpath, _realNode, 0, true));
myList.emplace_back(new FSNodeZIP(_zipFile, vpath, _realNode, 0, true));
}
// cerr << "list: \n";
@ -217,7 +215,7 @@ bool FilesystemNodeZIP::getChildren(AbstractFSList& myList, ListMode mode) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t FilesystemNodeZIP::read(ByteBuffer& image, size_t) const
size_t FSNodeZIP::read(ByteBuffer& image, size_t) const
{
switch(_error)
{
@ -240,7 +238,7 @@ size_t FilesystemNodeZIP::read(ByteBuffer& image, size_t) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t FilesystemNodeZIP::read(stringstream& image) const
size_t FSNodeZIP::read(stringstream& image) const
{
// For now, we just read into a buffer and store in the stream
// TODO: maybe there's a more efficient way to do this?
@ -253,21 +251,21 @@ size_t FilesystemNodeZIP::read(stringstream& image) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t FilesystemNodeZIP::write(const ByteBuffer& buffer, size_t size) const
size_t FSNodeZIP::write(const ByteBuffer& buffer, size_t size) const
{
// TODO: Not yet implemented
throw runtime_error("ZIP file not writable");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t FilesystemNodeZIP::write(const stringstream& buffer) const
size_t FSNodeZIP::write(const stringstream& buffer) const
{
// TODO: Not yet implemented
throw runtime_error("ZIP file not writable");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFSNodePtr FilesystemNodeZIP::getParent() const
AbstractFSNodePtr FSNodeZIP::getParent() const
{
if(_virtualPath == "")
return _realNode ? _realNode->getParent() : nullptr;
@ -275,10 +273,10 @@ AbstractFSNodePtr FilesystemNodeZIP::getParent() const
const char* start = _path.c_str();
const char* end = lastPathComponent(_path);
return make_unique<FilesystemNodeZIP>(string(start, end - start - 1));
return make_unique<FSNodeZIP>(string(start, end - start - 1));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr<ZipHandler> FilesystemNodeZIP::myZipHandler = make_unique<ZipHandler>();
unique_ptr<ZipHandler> FSNodeZIP::myZipHandler = make_unique<ZipHandler>();
#endif // ZIP_SUPPORT

View File

@ -32,15 +32,15 @@
*
* Parts of this class are documented in the base interface class, AbstractFSNode.
*/
class FilesystemNodeZIP : public AbstractFSNode
class FSNodeZIP : public AbstractFSNode
{
public:
/**
* Creates a FilesystemNodeZIP for a given path.
* Creates a FSNodeZIP for a given path.
*
* @param path String with the path the new node should point to.
*/
explicit FilesystemNodeZIP(const string& path);
explicit FSNodeZIP(const string& path);
bool exists() const override;
const string& getName() const override { return _name; }
@ -69,13 +69,13 @@ class FilesystemNodeZIP : public AbstractFSNode
size_t write(const stringstream& buffer) const override;
private:
FilesystemNodeZIP(const string& zipfile, const string& virtualpath,
FSNodeZIP(const string& zipfile, const string& virtualpath,
const AbstractFSNodePtr& realnode, size_t size, bool isdir);
void setFlags(const string& zipfile, const string& virtualpath,
const AbstractFSNodePtr& realnode);
friend ostream& operator<<(ostream& os, const FilesystemNodeZIP& node)
friend ostream& operator<<(ostream& os, const FSNodeZIP& node)
{
os << "_zipFile: " << node._zipFile << endl
<< "_virtualPath: " << node._virtualPath << endl

View File

@ -314,7 +314,7 @@ void PNGLibrary::takeSnapshot(uInt32 number)
// Determine if the file already exists, checking each successive filename
// until one doesn't exist
filename = sspath + ".png";
FilesystemNode node(filename);
FSNode node(filename);
if(node.exists())
{
ostringstream buf;
@ -322,7 +322,7 @@ void PNGLibrary::takeSnapshot(uInt32 number)
{
buf.str("");
buf << sspath << "_" << i << ".png";
FilesystemNode next(buf.str());
FSNode next(buf.str());
if(!next.exists())
break;
}

View File

@ -226,7 +226,7 @@ int main(int ac, char* av[])
else if(localOpts["rominfo"].toBool())
{
Logger::debug("Showing output from 'rominfo' ...");
FilesystemNode romnode(romfile);
FSNode romnode(romfile);
Logger::error(theOSystem->getROMInfo(romnode));
return Cleanup();
@ -245,7 +245,7 @@ int main(int ac, char* av[])
// open the rom launcher in that directory.
// If not, use the built-in ROM launcher. In this case, we enter 'launcher'
// mode and let the main event loop take care of opening a new console/ROM.
FilesystemNode romnode(romfile);
FSNode romnode(romfile);
if(romfile == "" || romnode.isDirectory())
{
Logger::debug("Attempting to use ROM launcher ...");

View File

@ -19,7 +19,7 @@
#include "Logger.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyValueRepositoryConfigfile::KeyValueRepositoryConfigfile(const FilesystemNode& file)
KeyValueRepositoryConfigfile::KeyValueRepositoryConfigfile(const FSNode& file)
: KeyValueRepositoryFile<KeyValueRepositoryConfigfile>(file)
{
}

View File

@ -27,7 +27,7 @@ class KeyValueRepositoryConfigfile : public KeyValueRepositoryFile<KeyValueRepos
using KeyValueRepositoryFile<KeyValueRepositoryConfigfile>::load;
using KeyValueRepositoryFile<KeyValueRepositoryConfigfile>::save;
explicit KeyValueRepositoryConfigfile(const FilesystemNode& node);
explicit KeyValueRepositoryConfigfile(const FSNode& node);
static std::map<string, Variant> load(istream& in);

View File

@ -28,7 +28,7 @@
template<class T>
class KeyValueRepositoryFile : public KeyValueRepository {
public:
explicit KeyValueRepositoryFile(const FilesystemNode& node);
explicit KeyValueRepositoryFile(const FSNode& node);
std::map<string, Variant> load() override;
@ -36,7 +36,7 @@ class KeyValueRepositoryFile : public KeyValueRepository {
protected:
const FilesystemNode& myNode;
const FSNode& myNode;
};
///////////////////////////////////////////////////////////////////////////////
@ -45,7 +45,7 @@ class KeyValueRepositoryFile : public KeyValueRepository {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<class T>
KeyValueRepositoryFile<T>::KeyValueRepositoryFile(const FilesystemNode& node)
KeyValueRepositoryFile<T>::KeyValueRepositoryFile(const FSNode& node)
: myNode{node}
{}

View File

@ -30,7 +30,7 @@ namespace {
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyValueRepositoryJsonFile::KeyValueRepositoryJsonFile(const FilesystemNode& node)
KeyValueRepositoryJsonFile::KeyValueRepositoryJsonFile(const FSNode& node)
: KeyValueRepositoryFile<KeyValueRepositoryJsonFile>(node)
{
}

View File

@ -29,7 +29,7 @@ class KeyValueRepositoryJsonFile : public KeyValueRepositoryFile<KeyValueReposit
using KeyValueRepositoryFile<KeyValueRepositoryJsonFile>::load;
using KeyValueRepositoryFile<KeyValueRepositoryJsonFile>::save;
explicit KeyValueRepositoryJsonFile(const FilesystemNode& node);
explicit KeyValueRepositoryJsonFile(const FSNode& node);
static std::map<string, Variant> load(istream& in);

View File

@ -71,7 +71,7 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyValueRepositoryPropertyFile::KeyValueRepositoryPropertyFile(
const FilesystemNode& node)
const FSNode& node)
: KeyValueRepositoryFile<KeyValueRepositoryPropertyFile>(node)
{
}

View File

@ -29,7 +29,7 @@ class KeyValueRepositoryPropertyFile : public KeyValueRepositoryFile<KeyValueRep
using KeyValueRepositoryFile<KeyValueRepositoryPropertyFile>::load;
using KeyValueRepositoryFile<KeyValueRepositoryPropertyFile>::save;
explicit KeyValueRepositoryPropertyFile(const FilesystemNode& node);
explicit KeyValueRepositoryPropertyFile(const FSNode& node);
static std::map<string, Variant> load(istream& in);

View File

@ -87,7 +87,7 @@ void StellaDb::initialize()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string StellaDb::databaseFileName() const
{
return myDb ? FilesystemNode(myDb->fileName()).getShortPath() : "[failed]";
return myDb ? FSNode(myDb->fileName()).getShortPath() : "[failed]";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -101,7 +101,7 @@ void StellaDb::initializeDb()
{
importOldSettings();
FilesystemNode legacyPropertyFile{myDatabaseDirectory};
FSNode legacyPropertyFile{myDatabaseDirectory};
legacyPropertyFile /= "stella.pro";
if (legacyPropertyFile.exists() && legacyPropertyFile.isFile())
@ -124,10 +124,10 @@ void StellaDb::importOldSettings()
constexpr char LEGACY_SETTINGS_FILE[] = "stellarc";
#endif
FilesystemNode legacyConfigFile{myDatabaseDirectory};
FSNode legacyConfigFile{myDatabaseDirectory};
legacyConfigFile /= LEGACY_SETTINGS_FILE;
FilesystemNode legacyConfigDatabase{myDatabaseDirectory};
FSNode legacyConfigDatabase{myDatabaseDirectory};
legacyConfigDatabase /= "settings.sqlite3";
if (legacyConfigDatabase.exists() && legacyConfigDatabase.isFile())
@ -138,7 +138,7 @@ void StellaDb::importOldSettings()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaDb::importStellarc(const FilesystemNode& node)
void StellaDb::importStellarc(const FSNode& node)
{
Logger::info("importing old settings from " + node.getPath());
@ -146,7 +146,7 @@ void StellaDb::importStellarc(const FilesystemNode& node)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaDb::importOldStellaDb(const FilesystemNode& node)
void StellaDb::importOldStellaDb(const FSNode& node)
{
Logger::info("importing old settings from " + node.getPath());
@ -167,7 +167,7 @@ void StellaDb::importOldStellaDb(const FilesystemNode& node)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaDb::importOldPropset(const FilesystemNode& node)
void StellaDb::importOldPropset(const FSNode& node)
{
Logger::info("importing old game properties from " + node.getPath());

View File

@ -44,9 +44,9 @@ class StellaDb
void initializeDb();
void importOldSettings();
void importStellarc(const FilesystemNode& node);
void importOldStellaDb(const FilesystemNode& node);
void importOldPropset(const FilesystemNode& node);
void importStellarc(const FSNode& node);
void importOldStellaDb(const FSNode& node);
void importOldPropset(const FSNode& node);
void migrate();

View File

@ -815,7 +815,7 @@ string CartDebug::loadListFile()
// The default naming/location for list files is the ROM dir based on the
// actual ROM filename
FilesystemNode lst(myOSystem.romFile().getPathWithExt(".lst"));
FSNode lst(myOSystem.romFile().getPathWithExt(".lst"));
if(!lst.isReadable())
return DebuggerParser::red("list file \'" + lst.getShortPath() + "\' not found");
@ -876,7 +876,7 @@ string CartDebug::loadSymbolFile()
// The default naming/location for symbol files is the ROM dir based on the
// actual ROM filename
FilesystemNode sym(myOSystem.romFile().getPathWithExt(".sym"));
FSNode sym(myOSystem.romFile().getPathWithExt(".sym"));
if(!sym.isReadable())
return DebuggerParser::red("symbol file \'" + sym.getShortPath() + "\' not found");
@ -937,8 +937,8 @@ string CartDebug::loadConfigFile()
// The default naming/location for config files is the CFG dir and based
// on the actual ROM filename
FilesystemNode romNode(myOSystem.romFile().getPathWithExt(".cfg"));
FilesystemNode cfg = myOSystem.cfgDir(); cfg /= romNode.getName();
FSNode romNode(myOSystem.romFile().getPathWithExt(".cfg"));
FSNode cfg = myOSystem.cfgDir(); cfg /= romNode.getName();
if(!cfg.isReadable())
return DebuggerParser::red("config file \'" + cfg.getShortPath() + "\' not found");
@ -1076,8 +1076,8 @@ string CartDebug::saveConfigFile()
stringstream retVal;
try
{
FilesystemNode romNode(myOSystem.romFile().getPathWithExt(".cfg"));
FilesystemNode cfg = myOSystem.cfgDir(); cfg /= romNode.getName();
FSNode romNode(myOSystem.romFile().getPathWithExt(".cfg"));
FSNode cfg = myOSystem.cfgDir(); cfg /= romNode.getName();
if(!cfg.getParent().isWritable())
return DebuggerParser::red("config file \'" + cfg.getShortPath() + "\' not writable");
@ -1413,7 +1413,7 @@ string CartDebug::saveDisassembly(string path)
if(path.find_last_of('.') == string::npos)
path += ".asm";
FilesystemNode node(path);
FSNode node(path);
stringstream retVal;
try
{
@ -1441,7 +1441,7 @@ string CartDebug::saveRom(string path)
if(path.find_last_of('.') == string::npos)
path += ".a26";
FilesystemNode node(path);
FSNode node(path);
if(myConsole.cartridge().saveROM(node))
return "saved ROM as " + node.getShortPath();
@ -1467,7 +1467,7 @@ string CartDebug::saveAccessFile(string path)
if(path.find_last_of('.') == string::npos)
path += ".csv";
FilesystemNode node(path);
FSNode node(path);
node.write(out);
return "saved access counters as " + node.getShortPath();

View File

@ -177,13 +177,13 @@ string Debugger::autoExec(StringList* history)
ostringstream buf;
// autoexec.script is always run
FilesystemNode autoexec(myOSystem.baseDir().getPath() + "autoexec.script");
FSNode autoexec(myOSystem.baseDir().getPath() + "autoexec.script");
buf << "autoExec():" << endl
<< myParser->exec(autoexec, history) << endl;
// Also, "romname.script" if present
const string path = myOSystem.userDir().getPath() + myOSystem.romFile().getNameWithExt(".script");
FilesystemNode romname(path);
FSNode romname(path);
buf << myParser->exec(romname, history) << endl;
// Init builtins

View File

@ -132,7 +132,7 @@ string DebuggerParser::run(const string& command)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string DebuggerParser::exec(const FilesystemNode& file, StringList* history)
string DebuggerParser::exec(const FSNode& file, StringList* history)
{
if(file.exists())
{
@ -686,10 +686,10 @@ string DebuggerParser::saveScriptFile(string file)
file += ".script";
// Use user dir if no path is provided
if(file.find_first_of(FilesystemNode::PATH_SEPARATOR) == string::npos)
if(file.find_first_of(FSNode::PATH_SEPARATOR) == string::npos)
file = debugger.myOSystem.userDir().getPath() + file;
FilesystemNode node(file);
FSNode node(file);
if(node.exists() || out.str().length())
{
@ -709,7 +709,7 @@ string DebuggerParser::saveScriptFile(string file)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerParser::saveDump(const FilesystemNode& node, const stringstream& out,
void DebuggerParser::saveDump(const FSNode& node, const stringstream& out,
ostringstream& result)
{
try
@ -1270,7 +1270,7 @@ void DebuggerParser::executeDump()
BrowserDialog::show(dlg, "Save Dump as", path.str(),
BrowserDialog::Mode::FileSave,
[this, dlg, outStr, resultStr]
(bool OK, const FilesystemNode& node)
(bool OK, const FSNode& node)
{
if(OK)
{
@ -1286,7 +1286,7 @@ void DebuggerParser::executeDump()
commandResult.str("_NO_PROMPT");
}
else
saveDump(FilesystemNode(path.str()), out, commandResult);
saveDump(FSNode(path.str()), out, commandResult);
}
}
@ -1298,9 +1298,9 @@ void DebuggerParser::executeExec()
string file = argStrings[0];
if(file.find_last_of('.') == string::npos)
file += ".script";
FilesystemNode node(file);
FSNode node(file);
if (!node.exists())
node = FilesystemNode(debugger.myOSystem.userDir().getPath() + file);
node = FSNode(debugger.myOSystem.userDir().getPath() + file);
if (argCount == 2) {
execPrefix = argStrings[1];
@ -1925,7 +1925,7 @@ void DebuggerParser::executeSave()
{
BrowserDialog::show(dlg, "Save Workbench as", fileName,
BrowserDialog::Mode::FileSave,
[this, dlg](bool OK, const FilesystemNode& node)
[this, dlg](bool OK, const FSNode& node)
{
if(OK)
dlg->prompt().print(saveScriptFile(node.getPath()) + '\n');
@ -1952,7 +1952,7 @@ void DebuggerParser::executeSaveAccess()
BrowserDialog::show(dlg, "Save Access Counters as",
dlg->instance().userDir().getPath() + cartName() + ".csv",
BrowserDialog::Mode::FileSave,
[this, dlg](bool OK, const FilesystemNode& node)
[this, dlg](bool OK, const FSNode& node)
{
if(OK)
dlg->prompt().print(debugger.cartDebug().saveAccessFile(node.getPath()) + '\n');
@ -1983,7 +1983,7 @@ void DebuggerParser::executeSaveDisassembly()
BrowserDialog::show(dlg, "Save Disassembly as",
dlg->instance().userDir().getPath() + cartName() + ".asm",
BrowserDialog::Mode::FileSave,
[this, dlg](bool OK, const FilesystemNode& node)
[this, dlg](bool OK, const FSNode& node)
{
if(OK)
dlg->prompt().print(debugger.cartDebug().saveDisassembly(node.getPath()) + '\n');
@ -2007,7 +2007,7 @@ void DebuggerParser::executeSaveRom()
BrowserDialog::show(dlg, "Save ROM as",
dlg->instance().userDir().getPath() + cartName() + ".a26",
BrowserDialog::Mode::FileSave,
[this, dlg](bool OK, const FilesystemNode& node)
[this, dlg](bool OK, const FSNode& node)
{
if(OK)
dlg->prompt().print(debugger.cartDebug().saveRom(node.getPath()) + '\n');
@ -2035,7 +2035,7 @@ void DebuggerParser::executeSaveSes()
BrowserDialog::show(dlg, "Save Session as",
dlg->instance().userDir().getPath() + filename.str(),
BrowserDialog::Mode::FileSave,
[this, dlg](bool OK, const FilesystemNode& node)
[this, dlg](bool OK, const FSNode& node)
{
if(OK)
dlg->prompt().print(debugger.prompt().saveBuffer(node) + '\n');
@ -2053,7 +2053,7 @@ void DebuggerParser::executeSaveSes()
else
path << debugger.myOSystem.userDir() << filename.str();
commandResult << debugger.prompt().saveBuffer(FilesystemNode(path.str()));
commandResult << debugger.prompt().saveBuffer(FSNode(path.str()));
}
}

View File

@ -23,7 +23,7 @@
class Debugger;
class Settings;
class FilesystemNode;
class FSNode;
struct Command;
#include "bspf.hxx"
@ -38,7 +38,7 @@ class DebuggerParser
string run(const string& command);
/** Execute parser commands given in 'file' */
string exec(const FilesystemNode& file, StringList* history = nullptr);
string exec(const FSNode& file, StringList* history = nullptr);
/** Given a substring, determine matching substrings from the list
of available commands. Used in the debugger prompt for tab-completion */
@ -65,7 +65,7 @@ class DebuggerParser
bool validateArgs(int cmd);
string eval();
string saveScriptFile(string file);
void saveDump(const FilesystemNode& node, const stringstream& out,
void saveDump(const FSNode& node, const stringstream& out,
ostringstream& result);
const string& cartName() const;

View File

@ -21,7 +21,7 @@
class Debugger;
class OSystem;
class DialogContainer;
class FilesystemNode;
class FSNode;
class ButtonWidget;
class CpuWidget;
class PromptWidget;

View File

@ -928,7 +928,7 @@ void PromptWidget::scrollToCurrent()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string PromptWidget::saveBuffer(const FilesystemNode& file)
string PromptWidget::saveBuffer(const FSNode& file)
{
stringstream out;
for(int start = 0; start < _promptStartPos; start += _lineWidth)

View File

@ -21,7 +21,7 @@
#include <cstdarg>
class ScrollBarWidget;
class FilesystemNode;
class FSNode;
#include "Widget.hxx"
#include "Command.hxx"
@ -44,7 +44,7 @@ class PromptWidget : public Widget, public CommandSender
public:
void print(const string& str);
void printPrompt();
string saveBuffer(const FilesystemNode& file);
string saveBuffer(const FSNode& file);
// Clear screen
void clearScreen();

View File

@ -22,7 +22,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AtariVox::AtariVox(Jack jack, const Event& event, const System& system,
const string& portname, const FilesystemNode& eepromfile,
const string& portname, const FSNode& eepromfile,
const onMessageCallback& callback)
: SaveKey(jack, event, system, eepromfile, callback, Controller::Type::AtariVox),
mySerialPort{MediaFactory::createSerialPort()}

View File

@ -20,7 +20,7 @@
class OSystem;
class SerialPort;
class FilesystemNode;
class FSNode;
#include "Control.hxx"
#include "SaveKey.hxx"
@ -48,7 +48,7 @@ class AtariVox : public SaveKey
@param callback Called to pass messages back to the parent controller
*/
AtariVox(Jack jack, const Event& event, const System& system,
const string& portname, const FilesystemNode& eepromfile,
const string& portname, const FSNode& eepromfile,
const onMessageCallback& callback);
~AtariVox() override;

View File

@ -40,7 +40,7 @@ string Bankswitch::typeToDesc(Bankswitch::Type type)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Bankswitch::Type Bankswitch::typeFromExtension(const FilesystemNode& file)
Bankswitch::Type Bankswitch::typeFromExtension(const FSNode& file)
{
const string& name = file.getPath();
const string::size_type idx = name.find_last_of('.');
@ -72,13 +72,13 @@ bool Bankswitch::isValidRomName(const string& name, string& ext)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Bankswitch::isValidRomName(const FilesystemNode& name, string& ext)
bool Bankswitch::isValidRomName(const FSNode& name, string& ext)
{
return isValidRomName(name.getPath(), ext);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Bankswitch::isValidRomName(const FilesystemNode& name)
bool Bankswitch::isValidRomName(const FSNode& name)
{
string ext; // extension not used
return isValidRomName(name.getPath(), ext);

View File

@ -71,7 +71,7 @@ class Bankswitch
// Determine bankswitch type by filename extension
// Use '_AUTO' if unknown
static Bankswitch::Type typeFromExtension(const FilesystemNode& file);
static Bankswitch::Type typeFromExtension(const FSNode& file);
/**
Is this a valid ROM filename (does it have a valid extension?).
@ -84,8 +84,8 @@ class Bankswitch
/**
Convenience functions for different parameter types.
*/
static bool isValidRomName(const FilesystemNode& name, string& ext);
static bool isValidRomName(const FilesystemNode& name);
static bool isValidRomName(const FSNode& name, string& ext);
static bool isValidRomName(const FSNode& name);
static bool isValidRomName(const string& name);
// Output operator

View File

@ -53,7 +53,7 @@ void Cartridge::setAbout(const string& about, const string& type,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::saveROM(const FilesystemNode& out) const
bool Cartridge::saveROM(const FSNode& out) const
{
try
{

View File

@ -19,7 +19,7 @@
#define CARTRIDGE_HXX
class Properties;
class FilesystemNode;
class FSNode;
class CartDebugWidget;
class CartRamWidget;
class GuiObject;
@ -79,7 +79,7 @@ class Cartridge : public Device
@param out The output file to save the image
*/
bool saveROM(const FilesystemNode& out) const;
bool saveROM(const FSNode& out) const;
/**
Lock/unlock bankswitching and other hotspot capabilities. The debugger

View File

@ -70,7 +70,7 @@
#include "CartCreator.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr<Cartridge> CartCreator::create(const FilesystemNode& file,
unique_ptr<Cartridge> CartCreator::create(const FSNode& file,
const ByteBuffer& image, size_t size, string& md5,
const string& propertiesType, Settings& settings)
{

View File

@ -45,7 +45,7 @@ class CartCreator
@param settings The settings container
@return Pointer to the new cartridge object allocated on the heap
*/
static unique_ptr<Cartridge> create(const FilesystemNode& file,
static unique_ptr<Cartridge> create(const FSNode& file,
const ByteBuffer& image, size_t size, string& md5,
const string& dtype, Settings& settings);

View File

@ -728,7 +728,7 @@ bool CartDetector::isProbablyMVC(const ByteBuffer& image, size_t size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t CartDetector::isProbablyMVC(const FilesystemNode& rom)
size_t CartDetector::isProbablyMVC(const FSNode& rom)
{
constexpr size_t frameSize = 2 * CartridgeMVC::MVC_FIELD_PAD_SIZE;

View File

@ -45,7 +45,7 @@ class CartDetector
MVC cartridges are of arbitary large length
Returns size of frame if stream is probably an MVC movie cartridge
*/
static size_t isProbablyMVC(const FilesystemNode& rom);
static size_t isProbablyMVC(const FSNode& rom);
/**
Returns true if the image is probably a HSC PlusROM

View File

@ -972,7 +972,7 @@ unique_ptr<Controller> Console::getControllerPort(const Controller::Type type,
case Controller::Type::AtariVox:
{
FilesystemNode nvramfile = myOSystem.nvramDir();
FSNode nvramfile = myOSystem.nvramDir();
nvramfile /= "atarivox_eeprom.dat";
Controller::onMessageCallback callback = [&os = myOSystem](const string& msg) {
bool devSettings = os.settings().getBool("dev.settings");
@ -985,7 +985,7 @@ unique_ptr<Controller> Console::getControllerPort(const Controller::Type type,
}
case Controller::Type::SaveKey:
{
FilesystemNode nvramfile = myOSystem.nvramDir();
FSNode nvramfile = myOSystem.nvramDir();
nvramfile /= "savekey_eeprom.dat";
Controller::onMessageCallback callback = [&os = myOSystem](const string& msg) {
bool devSettings = os.settings().getBool("dev.settings");

View File

@ -20,19 +20,19 @@
#include "CartDetector.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNode::FilesystemNode(const AbstractFSNodePtr& realNode)
FSNode::FSNode(const AbstractFSNodePtr& realNode)
: _realNode{realNode}
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNode::FilesystemNode(const string& path)
FSNode::FSNode(const string& path)
{
setPath(path);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FilesystemNode::setPath(const string& path)
void FSNode::setPath(const string& path)
{
// Only create a new object when necessary
if (path == getPath())
@ -41,16 +41,14 @@ void FilesystemNode::setPath(const string& path)
// Is this potentially a ZIP archive?
#if defined(ZIP_SUPPORT)
if (BSPF::containsIgnoreCase(path, ".zip"))
_realNode = FilesystemNodeFactory::create(path,
FilesystemNodeFactory::Type::ZIP);
_realNode = FSNodeFactory::create(path, FSNodeFactory::Type::ZIP);
else
#endif
_realNode = FilesystemNodeFactory::create(path,
FilesystemNodeFactory::Type::SYSTEM);
_realNode = FSNodeFactory::create(path, FSNodeFactory::Type::SYSTEM);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNode& FilesystemNode::operator/=(const string& path)
FSNode& FSNode::operator/=(const string& path)
{
if (path != EmptyString)
{
@ -65,16 +63,16 @@ FilesystemNode& FilesystemNode::operator/=(const string& path)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNode::exists() const
bool FSNode::exists() const
{
return _realNode ? _realNode->exists() : false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNode::getAllChildren(FSList& fslist, ListMode mode,
const NameFilter& filter,
bool includeParentDirectory,
const CancelCheck& isCancelled) const
bool FSNode::getAllChildren(FSList& fslist, ListMode mode,
const NameFilter& filter,
bool includeParentDirectory,
const CancelCheck& isCancelled) const
{
if(getChildren(fslist, mode, filter, includeParentDirectory, true, isCancelled))
{
@ -86,14 +84,14 @@ bool FilesystemNode::getAllChildren(FSList& fslist, ListMode mode,
{
if(BSPF::endsWithIgnoreCase(i.getPath(), ".zip"))
{
FilesystemNodeZIP zipNode(i.getPath());
FSNodeZIP zipNode(i.getPath());
i.setName(zipNode.getName());
}
}
#endif
std::sort(fslist.begin(), fslist.end(),
[](const FilesystemNode& node1, const FilesystemNode& node2)
[](const FSNode& node1, const FSNode& node2)
{
if(node1.isDirectory() != node2.isDirectory())
return node1.isDirectory();
@ -109,9 +107,9 @@ bool FilesystemNode::getAllChildren(FSList& fslist, ListMode mode,
if(BSPF::endsWithIgnoreCase(i.getPath(), ".zip"))
{
// Force ZIP c'tor to be called
AbstractFSNodePtr ptr = FilesystemNodeFactory::create(
i.getPath(), FilesystemNodeFactory::Type::ZIP);
FilesystemNode zipNode(ptr);
AbstractFSNodePtr ptr = FSNodeFactory::create(
i.getPath(), FSNodeFactory::Type::ZIP);
FSNode zipNode(ptr);
i = zipNode;
}
}
@ -122,11 +120,11 @@ bool FilesystemNode::getAllChildren(FSList& fslist, ListMode mode,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
const NameFilter& filter,
bool includeChildDirectories,
bool includeParentDirectory,
const CancelCheck& isCancelled) const
bool FSNode::getChildren(FSList& fslist, ListMode mode,
const NameFilter& filter,
bool includeChildDirectories,
bool includeParentDirectory,
const CancelCheck& isCancelled) const
{
if (!_realNode || !_realNode->isDirectory())
return false;
@ -150,7 +148,7 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
{
if(BSPF::endsWithIgnoreCase(i->getPath(), ".zip"))
{
FilesystemNodeZIP node(i->getPath());
FSNodeZIP node(i->getPath());
i->setName(node.getName());
}
}
@ -170,7 +168,7 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
// Add parent node, if it is valid to do so
if (includeParentDirectory && hasParent())
{
FilesystemNode parent = getParent();
FSNode parent = getParent();
parent.setName("..");
fslist.emplace_back(parent);
}
@ -185,9 +183,9 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
if (BSPF::endsWithIgnoreCase(i->getPath(), ".zip"))
{
// Force ZIP c'tor to be called
AbstractFSNodePtr ptr = FilesystemNodeFactory::create(
i->getPath(), FilesystemNodeFactory::Type::ZIP);
FilesystemNode zipNode(ptr);
AbstractFSNodePtr ptr = FSNodeFactory::create(
i->getPath(), FSNodeFactory::Type::ZIP);
FSNode zipNode(ptr);
if(filter(zipNode))
{
@ -196,7 +194,7 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
else
{
// filter by zip node but add file node
FilesystemNode node(i);
FSNode node(i);
fslist.emplace_back(node);
}
}
@ -204,7 +202,7 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
else
#endif
{
FilesystemNode node(i);
FSNode node(i);
if(includeChildDirectories)
{
@ -226,32 +224,32 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string& FilesystemNode::getName() const
const string& FSNode::getName() const
{
return _realNode ? _realNode->getName() : EmptyString;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FilesystemNode::setName(const string& name)
void FSNode::setName(const string& name)
{
if (_realNode)
_realNode->setName(name);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string& FilesystemNode::getPath() const
const string& FSNode::getPath() const
{
return _realNode ? _realNode->getPath() : EmptyString;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FilesystemNode::getShortPath() const
string FSNode::getShortPath() const
{
return _realNode ? _realNode->getShortPath() : EmptyString;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FilesystemNode::getNameWithExt(const string& ext) const
string FSNode::getNameWithExt(const string& ext) const
{
if (!_realNode)
return EmptyString;
@ -265,7 +263,7 @@ string FilesystemNode::getNameWithExt(const string& ext) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FilesystemNode::getPathWithExt(const string& ext) const
string FSNode::getPathWithExt(const string& ext) const
{
if (!_realNode)
return EmptyString;
@ -277,65 +275,65 @@ string FilesystemNode::getPathWithExt(const string& ext) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNode::hasParent() const
bool FSNode::hasParent() const
{
return _realNode ? _realNode->hasParent() : false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNode FilesystemNode::getParent() const
FSNode FSNode::getParent() const
{
if (!_realNode)
return *this;
AbstractFSNodePtr node = _realNode->getParent();
return node ? FilesystemNode(node) : *this;
return node ? FSNode(node) : *this;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNode::isDirectory() const
bool FSNode::isDirectory() const
{
return _realNode ? _realNode->isDirectory() : false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNode::isFile() const
bool FSNode::isFile() const
{
return _realNode ? _realNode->isFile() : false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNode::isReadable() const
bool FSNode::isReadable() const
{
return _realNode ? _realNode->isReadable() : false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNode::isWritable() const
bool FSNode::isWritable() const
{
return _realNode ? _realNode->isWritable() : false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNode::makeDir()
bool FSNode::makeDir()
{
return (_realNode && !_realNode->exists()) ? _realNode->makeDir() : false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNode::rename(const string& newfile)
bool FSNode::rename(const string& newfile)
{
return (_realNode && _realNode->exists()) ? _realNode->rename(newfile) : false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t FilesystemNode::getSize() const
size_t FSNode::getSize() const
{
return (_realNode && _realNode->exists()) ? _realNode->getSize() : 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t FilesystemNode::read(ByteBuffer& buffer, size_t size) const
size_t FSNode::read(ByteBuffer& buffer, size_t size) const
{
size_t sizeRead = 0;
@ -370,7 +368,7 @@ size_t FilesystemNode::read(ByteBuffer& buffer, size_t size) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t FilesystemNode::read(stringstream& buffer) const
size_t FSNode::read(stringstream& buffer) const
{
size_t sizeRead = 0;
@ -403,7 +401,7 @@ size_t FilesystemNode::read(stringstream& buffer) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t FilesystemNode::write(const ByteBuffer& buffer, size_t size) const
size_t FSNode::write(const ByteBuffer& buffer, size_t size) const
{
size_t sizeWritten = 0;
@ -428,7 +426,7 @@ size_t FilesystemNode::write(const ByteBuffer& buffer, size_t size) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t FilesystemNode::write(const stringstream& buffer) const
size_t FSNode::write(const stringstream& buffer) const
{
size_t sizeWritten = 0;

View File

@ -31,7 +31,7 @@
* paths (and it's left to them whether / or \ or : is the path separator :-).
*/
class FilesystemNode;
class FSNode;
class AbstractFSNode;
using AbstractFSNodePtr = shared_ptr<AbstractFSNode>;
@ -40,13 +40,13 @@ using AbstractFSNodePtr = shared_ptr<AbstractFSNode>;
* This is subclass instead of just a typedef so that we can use forward
* declarations of it in other places.
*/
class FSList : public vector<FilesystemNode> { };
class FSList : public vector<FSNode> { };
/**
* This class acts as a wrapper around the AbstractFSNode class defined
* in backends/fs.
*/
class FilesystemNode
class FSNode
{
public:
#ifdef BSPF_WINDOWS
@ -63,19 +63,19 @@ class FilesystemNode
/** Function used to filter the file listing. Returns true if the filename
should be included, else false.*/
using NameFilter = std::function<bool(const FilesystemNode& node)>;
using NameFilter = std::function<bool(const FSNode& node)>;
using CancelCheck = std::function<bool()> const;
/**
* Create a new pathless FilesystemNode. Since there's no path associated
* Create a new pathless FSNode. Since there's no path associated
* with this node, path-related operations (i.e. exists(), isDirectory(),
* getPath()) will always return false or raise an assertion.
*/
FilesystemNode() = default;
~FilesystemNode() = default;
FSNode() = default;
~FSNode() = default;
/**
* Create a new FilesystemNode referring to the specified path. This is
* Create a new FSNode referring to the specified path. This is
* the counterpart to the path() method.
*
* If path is empty or equals '~', then a node representing the
@ -83,21 +83,21 @@ class FilesystemNode
* operating system doesn't support the concept), some other directory is
* used (usually the root directory).
*/
explicit FilesystemNode(const string& path);
explicit FSNode(const string& path);
/**
* Assignment operators.
*/
FilesystemNode(const FilesystemNode&) = default;
FilesystemNode& operator=(const FilesystemNode&) = default;
FilesystemNode& operator=(FilesystemNode&&) = default;
FilesystemNode(FilesystemNode&&) = default;
FSNode(const FSNode&) = default;
FSNode& operator=(const FSNode&) = default;
FSNode& operator=(FSNode&&) = default;
FSNode(FSNode&&) = default;
/**
* Compare the name of this node to the name of another, testing for
* equality.
*/
inline bool operator==(const FilesystemNode& node) const
inline bool operator==(const FSNode& node) const
{
return BSPF::compareIgnoreCase(getName(), node.getName()) == 0;
}
@ -106,13 +106,13 @@ class FilesystemNode
* Append the given path to the node, adding a directory separator
* when necessary. Modelled on the C++17 fs::path API.
*/
FilesystemNode& operator/=(const string& path);
FSNode& operator/=(const string& path);
/**
* By default, the output operator simply outputs the fully-qualified
* pathname of the node.
*/
friend ostream& operator<<(ostream& os, const FilesystemNode& node)
friend ostream& operator<<(ostream& os, const FSNode& node)
{
return os << node.getPath();
}
@ -133,7 +133,7 @@ class FilesystemNode
* does not exist).
*/
bool getAllChildren(FSList& fslist, ListMode mode = ListMode::DirectoriesOnly,
const NameFilter& filter = [](const FilesystemNode&) { return true; },
const NameFilter& filter = [](const FSNode&) { return true; },
bool includeParentDirectory = true,
const CancelCheck& isCancelled = []() { return false; }) const;
@ -145,7 +145,7 @@ class FilesystemNode
* does not exist).
*/
bool getChildren(FSList& fslist, ListMode mode = ListMode::DirectoriesOnly,
const NameFilter& filter = [](const FilesystemNode&){ return true; },
const NameFilter& filter = [](const FSNode&){ return true; },
bool includeChildDirectories = false,
bool includeParentDirectory = true,
const CancelCheck& isCancelled = []() { return false; }) const;
@ -188,7 +188,7 @@ class FilesystemNode
* Get the parent node of this node. If this node has no parent node,
* then it returns a duplicate of this node.
*/
FilesystemNode getParent() const;
FSNode getParent() const;
/**
* Indicates whether the path refers to a directory or not.
@ -306,7 +306,7 @@ class FilesystemNode
string getPathWithExt(const string& ext) const;
private:
explicit FilesystemNode(const AbstractFSNodePtr& realNode);
explicit FSNode(const AbstractFSNodePtr& realNode);
AbstractFSNodePtr _realNode;
void setPath(const string& path);
};
@ -326,9 +326,9 @@ using AbstractFSList = vector<AbstractFSNodePtr>;
class AbstractFSNode
{
protected:
friend class FilesystemNode;
using ListMode = FilesystemNode::ListMode;
using NameFilter = FilesystemNode::NameFilter;
friend class FSNode;
using ListMode = FSNode::ListMode;
using NameFilter = FSNode::NameFilter;
public:
/**
@ -360,7 +360,7 @@ class AbstractFSNode
virtual bool getChildren(AbstractFSList& list, ListMode mode) const = 0;
/**
* Returns the last component of the path pointed by this FilesystemNode.
* Returns the last component of the path pointed by this FSNode.
*
* Examples (POSIX):
* /foo/bar.txt would return /bar.txt

View File

@ -18,7 +18,7 @@
#ifndef MD5_HXX
#define MD5_HXX
class FilesystemNode;
class FSNode;
#include "bspf.hxx"

View File

@ -43,7 +43,7 @@
*/
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MT24LC256::MT24LC256(const FilesystemNode& eepromfile, const System& system,
MT24LC256::MT24LC256(const FSNode& eepromfile, const System& system,
const Controller::onMessageCallback& callback)
: mySystem{system},
myCallback{callback},

View File

@ -41,7 +41,7 @@ class MT24LC256
@param system The system using the controller of this device
@param callback Called to pass messages back to the parent controller
*/
MT24LC256(const FilesystemNode& eepromfile, const System& system,
MT24LC256(const FSNode& eepromfile, const System& system,
const Controller::onMessageCallback& callback);
~MT24LC256();
@ -111,7 +111,7 @@ class MT24LC256
uInt64 myCyclesWhenSDASet{0}, myCyclesWhenSCLSet{0};
// The file containing the EEPROM data
FilesystemNode myDataFile;
FSNode myDataFile;
// Indicates if the EEPROM has changed since class invocation
bool myDataChanged{false};

View File

@ -223,11 +223,11 @@ void OSystem::loadConfig(const Settings::Options& options)
ourOverrideBaseDirWithApp, ourOverrideBaseDir);
// Get fully-qualified pathnames, and make directories when needed
myBaseDir = FilesystemNode(baseDir);
myBaseDir = FSNode(baseDir);
if(!myBaseDir.isDirectory())
myBaseDir.makeDir();
myHomeDir = FilesystemNode(homeDir);
myHomeDir = FSNode(homeDir);
if(!myHomeDir.isDirectory())
myHomeDir.makeDir();
@ -242,7 +242,7 @@ void OSystem::loadConfig(const Settings::Options& options)
string userDir = mySettings->getString("userdir");
if(userDir.empty())
userDir = homeDir;
myUserDir = FilesystemNode(userDir);
myUserDir = FSNode(userDir);
if(!myUserDir.isDirectory())
myUserDir.makeDir();
@ -272,8 +272,8 @@ void OSystem::saveConfig()
void OSystem::setConfigPaths()
{
// Make sure all required directories actually exist
const auto buildDirIfRequired = [](FilesystemNode& path,
const FilesystemNode& initialPath,
const auto buildDirIfRequired = [](FSNode& path,
const FSNode& initialPath,
const string& pathToAppend = EmptyString)
{
path = initialPath;
@ -294,7 +294,7 @@ void OSystem::setConfigPaths()
if(ssSaveDir == EmptyString)
mySnapshotSaveDir = userDir();
else
mySnapshotSaveDir = FilesystemNode(ssSaveDir);
mySnapshotSaveDir = FSNode(ssSaveDir);
if(!mySnapshotSaveDir.isDirectory())
mySnapshotSaveDir.makeDir();
@ -302,7 +302,7 @@ void OSystem::setConfigPaths()
if(ssLoadDir == EmptyString)
mySnapshotLoadDir = userDir();
else
mySnapshotLoadDir = FilesystemNode(ssLoadDir);
mySnapshotLoadDir = FSNode(ssLoadDir);
if(!mySnapshotLoadDir.isDirectory())
mySnapshotLoadDir.makeDir();
#endif
@ -312,7 +312,7 @@ void OSystem::setConfigPaths()
#if 0
// Debug code
auto dbgPath = [](const string& desc, const FilesystemNode& location)
auto dbgPath = [](const string& desc, const FSNode& location)
{
cerr << desc << ": " << location << endl;
};
@ -332,7 +332,7 @@ void OSystem::setUserDir(const string& path)
{
mySettings->setValue("userdir", path);
myUserDir = FilesystemNode(path);
myUserDir = FSNode(path);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -413,7 +413,7 @@ void OSystem::createSound()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
string OSystem::createConsole(const FSNode& rom, const string& md5sum,
bool newrom)
{
bool showmessage = false;
@ -489,7 +489,7 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
}
buf << "Game console created:" << endl
<< " ROM file: " << myRomFile.getShortPath() << endl;
FilesystemNode propsFile(myRomFile.getPathWithExt(".pro"));
FSNode propsFile(myRomFile.getPathWithExt(".pro"));
if(propsFile.exists())
buf << " PRO file: " << propsFile.getShortPath() << endl;
buf << endl << getROMInfo(*myConsole);
@ -602,7 +602,7 @@ bool OSystem::launcherLostFocus()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string OSystem::getROMInfo(const FilesystemNode& romfile)
string OSystem::getROMInfo(const FSNode& romfile)
{
unique_ptr<Console> console;
try
@ -634,7 +634,7 @@ void OSystem::resetFps()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr<Console> OSystem::openConsole(const FilesystemNode& romfile, string& md5)
unique_ptr<Console> OSystem::openConsole(const FSNode& romfile, string& md5)
{
unique_ptr<Console> console;
@ -746,7 +746,7 @@ void OSystem::closeConsole()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteBuffer OSystem::openROM(const FilesystemNode& rom, string& md5, size_t& size)
ByteBuffer OSystem::openROM(const FSNode& rom, string& md5, size_t& size)
{
// This method has a documented side-effect:
// It not only loads a ROM and creates an array with its contents,
@ -770,7 +770,7 @@ ByteBuffer OSystem::openROM(const FilesystemNode& rom, string& md5, size_t& size
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string OSystem::getROMMD5(const FilesystemNode& rom) const
string OSystem::getROMMD5(const FSNode& rom) const
{
size_t size = 0;
const ByteBuffer image = openROM(rom, size, false); // ignore error message
@ -779,7 +779,7 @@ string OSystem::getROMMD5(const FilesystemNode& rom) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ByteBuffer OSystem::openROM(const FilesystemNode& rom, size_t& size,
ByteBuffer OSystem::openROM(const FSNode& rom, size_t& size,
bool showErrorMessage) const
{
// First check if this is a valid ROM filename

View File

@ -266,31 +266,31 @@ class OSystem
/**
Return the default full/complete path name for storing data.
*/
const FilesystemNode& baseDir() const { return myBaseDir; }
const FSNode& baseDir() const { return myBaseDir; }
/**
Return the full/complete path name for storing state files.
*/
const FilesystemNode& stateDir() const { return myStateDir; }
const FSNode& stateDir() const { return myStateDir; }
/**
Return the full/complete path name for storing nvram
(flash/EEPROM) files.
*/
const FilesystemNode& nvramDir() const { return myNVRamDir; }
const FSNode& nvramDir() const { return myNVRamDir; }
#ifdef CHEATCODE_SUPPORT
/**
Return the full/complete path name of the cheat file.
*/
const FilesystemNode& cheatFile() const { return myCheatFile; }
const FSNode& cheatFile() const { return myCheatFile; }
#endif
#ifdef DEBUGGER_SUPPORT
/**
Return the full/complete path name for storing Distella cfg files.
*/
const FilesystemNode& cfgDir() const { return myCfgDir; }
const FSNode& cfgDir() const { return myCfgDir; }
#endif
#ifdef PNG_SUPPORT
@ -298,14 +298,14 @@ class OSystem
Return the full/complete path name for saving and loading
PNG snapshots.
*/
const FilesystemNode& snapshotSaveDir() const { return mySnapshotSaveDir; }
const FilesystemNode& snapshotLoadDir() const { return mySnapshotLoadDir; }
const FSNode& snapshotSaveDir() const { return mySnapshotSaveDir; }
const FSNode& snapshotLoadDir() const { return mySnapshotLoadDir; }
#endif
/**
Return the full/complete path name of the (optional) palette file.
*/
const FilesystemNode& paletteFile() const { return myPaletteFile; }
const FSNode& paletteFile() const { return myPaletteFile; }
/**
Checks if a valid a user-defined palette file exists.
@ -315,14 +315,14 @@ class OSystem
/**
Return the full/complete path name of the currently loaded ROM.
*/
const FilesystemNode& romFile() const { return myRomFile; }
const FSNode& romFile() const { return myRomFile; }
/**
The default and user defined locations for saving and loading various
files that don't already have a specific location.
*/
const FilesystemNode& homeDir() const { return myHomeDir; }
const FilesystemNode& userDir() const { return myUserDir; }
const FSNode& homeDir() const { return myHomeDir; }
const FSNode& userDir() const { return myUserDir; }
/**
Open the given ROM and return an array containing its contents.
@ -336,7 +336,7 @@ class OSystem
@return Unique pointer to the array
*/
ByteBuffer openROM(const FilesystemNode& rom, string& md5, size_t& size);
ByteBuffer openROM(const FSNode& rom, string& md5, size_t& size);
/**
Open the given ROM and return the MD5sum of the data.
@ -345,7 +345,7 @@ class OSystem
@return MD5 of the ROM image (if valid), otherwise EmptyString
*/
string getROMMD5(const FilesystemNode& rom) const;
string getROMMD5(const FSNode& rom) const;
/**
Creates a new game console from the specified romfile, and correctly
@ -357,7 +357,7 @@ class OSystem
@return String indicating any error message (EmptyString for no errors)
*/
string createConsole(const FilesystemNode& rom, const string& md5 = "",
string createConsole(const FSNode& rom, const string& md5 = "",
bool newrom = true);
/**
@ -402,7 +402,7 @@ class OSystem
@param romfile The file node of the ROM to use
@return Some information about this ROM
*/
string getROMInfo(const FilesystemNode& romfile);
string getROMInfo(const FSNode& romfile);
/**
Toggle state rewind recording mode; this uses the RewindManager
@ -499,7 +499,7 @@ class OSystem
virtual void getBaseDirectories(string& basedir, string& homedir,
bool useappdir, const string& usedir) = 0;
virtual void initPersistence(FilesystemNode& basedir) = 0;
virtual void initPersistence(FSNode& basedir) = 0;
virtual string describePresistence() = 0;
@ -587,10 +587,10 @@ class OSystem
bool myQuitLoop{false};
private:
FilesystemNode myBaseDir, myStateDir, mySnapshotSaveDir, mySnapshotLoadDir,
myNVRamDir, myCfgDir, myHomeDir, myUserDir;
FilesystemNode myCheatFile, myPaletteFile;
FilesystemNode myRomFile; string myRomMD5;
FSNode myBaseDir, myStateDir, mySnapshotSaveDir, mySnapshotLoadDir,
myNVRamDir, myCfgDir, myHomeDir, myUserDir;
FSNode myCheatFile, myPaletteFile;
FSNode myRomFile; string myRomMD5;
string myFeatures;
string myBuildInfo;
@ -628,7 +628,7 @@ class OSystem
@return Unique pointer to the array, otherwise nullptr
*/
ByteBuffer openROM(const FilesystemNode& romfile, size_t& size,
ByteBuffer openROM(const FSNode& romfile, size_t& size,
bool showErrorMessage) const;
/**
@ -639,7 +639,7 @@ class OSystem
@return The actual Console object, otherwise nullptr
*/
unique_ptr<Console> openConsole(const FilesystemNode& romfile, string& md5);
unique_ptr<Console> openConsole(const FSNode& romfile, string& md5);
/**
Close and finalize any currently open console.

View File

@ -19,7 +19,7 @@
#include "OSystemStandalone.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemStandalone::initPersistence(FilesystemNode& basedir)
void OSystemStandalone::initPersistence(FSNode& basedir)
{
myStellaDb = make_shared<StellaDb>(basedir.getPath(), "stella");
myStellaDb->initialize();

View File

@ -36,7 +36,7 @@ class OSystemStandalone : public OSystem
protected:
void initPersistence(FilesystemNode& basedir) override;
void initPersistence(FSNode& basedir) override;
string describePresistence() override;

View File

@ -96,7 +96,7 @@ bool ProfilingRunner::run()
// stacksize '16384'. Consider moving some data to heap.
bool ProfilingRunner::runOne(const ProfilingRun& run)
{
FilesystemNode imageFile(run.romFile);
FSNode imageFile(run.romFile);
if (!imageFile.isFile()) {
cout << "ERROR: " << run.romFile << " is not a ROM image" << endl;

View File

@ -144,7 +144,7 @@ void PropertiesSet::insert(const Properties& properties, bool save)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PropertiesSet::loadPerROM(const FilesystemNode& rom, const string& md5)
void PropertiesSet::loadPerROM(const FSNode& rom, const string& md5)
{
Properties props;
@ -154,7 +154,7 @@ void PropertiesSet::loadPerROM(const FilesystemNode& rom, const string& md5)
// First, does this ROM have a per-ROM properties entry?
// If so, load it into the database
FilesystemNode propsNode(rom.getPathWithExt(".pro"));
FSNode propsNode(rom.getPathWithExt(".pro"));
if (propsNode.exists()) {
KeyValueRepositoryPropertyFile repo(propsNode);
props.load(repo);

View File

@ -20,7 +20,7 @@
#include <map>
class FilesystemNode;
class FSNode;
class OSystem;
#include "bspf.hxx"
@ -82,7 +82,7 @@ class PropertiesSet
@param rom The node representing the rom file
@param md5 The md5 of the property to get
*/
void loadPerROM(const FilesystemNode& rom, const string& md5);
void loadPerROM(const FSNode& rom, const string& md5);
/**
Prints the contents of the PropertiesSet as a flat file.

View File

@ -68,7 +68,7 @@ QuadTari::QuadTari(Jack jack, const OSystem& osystem, const System& system,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr<Controller> QuadTari::addController(const Controller::Type type, bool second)
{
FilesystemNode nvramfile = myOSystem.nvramDir();
FSNode nvramfile = myOSystem.nvramDir();
Controller::onMessageCallback callback = [&os = myOSystem](const string& msg) {
bool devSettings = os.settings().getBool("dev.settings");
if(os.settings().getBool(devSettings ? "dev.extaccess" : "plr.extaccess"))

View File

@ -22,7 +22,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SaveKey::SaveKey(Jack jack, const Event& event, const System& system,
const FilesystemNode& eepromfile, const onMessageCallback& callback,
const FSNode& eepromfile, const onMessageCallback& callback,
Type type)
: Controller(jack, event, system, type),
myEEPROM{make_unique<MT24LC256>(eepromfile, system, callback)}
@ -33,7 +33,7 @@ SaveKey::SaveKey(Jack jack, const Event& event, const System& system,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SaveKey::SaveKey(Jack jack, const Event& event, const System& system,
const FilesystemNode& eepromfile, const onMessageCallback& callback)
const FSNode& eepromfile, const onMessageCallback& callback)
: SaveKey(jack, event, system, eepromfile, callback, Controller::Type::SaveKey)
{
}

View File

@ -20,7 +20,7 @@
class MT24LC256;
class OSystem;
class FilesystemNode;
class FSNode;
#include "Control.hxx"
@ -46,7 +46,7 @@ class SaveKey : public Controller
@param callback Called to pass messages back to the parent controller
*/
SaveKey(Jack jack, const Event& event, const System& system,
const FilesystemNode& eepromfile, const onMessageCallback& callback);
const FSNode& eepromfile, const onMessageCallback& callback);
~SaveKey() override;
protected:
@ -55,7 +55,7 @@ class SaveKey : public Controller
that inherit from SaveKey (currently, AtariVox)
*/
SaveKey(Jack jack, const Event& event, const System& system,
const FilesystemNode& eepromfile,
const FSNode& eepromfile,
const onMessageCallback& callback, Type type);
public:

View File

@ -26,7 +26,7 @@ Serializer::Serializer(const string& filename, Mode m)
{
if(m == Mode::ReadOnly)
{
FilesystemNode node(filename);
FSNode node(filename);
if(node.isFile() && node.isReadable())
{
unique_ptr<fstream> str = make_unique<fstream>(filename, ios::in | ios::binary);

View File

@ -115,7 +115,7 @@ void BrowserDialog::show(GuiObject* parent, const GUI::Font& font,
const string& title, const string& startpath,
BrowserDialog::Mode mode,
const Command& command,
const FilesystemNode::NameFilter& namefilter)
const FSNode::NameFilter& namefilter)
{
uInt32 w = 0, h = 0;
@ -136,7 +136,7 @@ void BrowserDialog::show(GuiObject* parent,
const string& title, const string& startpath,
BrowserDialog::Mode mode,
const Command& command,
const FilesystemNode::NameFilter& namefilter)
const FSNode::NameFilter& namefilter)
{
show(parent, parent->instance().frameBuffer().font(), title, startpath,
mode, command, namefilter);
@ -153,7 +153,7 @@ void BrowserDialog::hide()
void BrowserDialog::show(const string& startpath,
BrowserDialog::Mode mode,
const Command& command,
const FilesystemNode::NameFilter& namefilter)
const FSNode::NameFilter& namefilter)
{
const int fontWidth = Dialog::fontWidth(),
VGAP = Dialog::vGap();
@ -167,7 +167,7 @@ void BrowserDialog::show(const string& startpath,
if(_mode != Mode::Directories)
{
// split startpath into path and filename
FilesystemNode fs = FilesystemNode(startpath);
FSNode fs = FSNode(startpath);
fileName = fs.getName();
directory = fs.isDirectory() ? "" : fs.getParent().getPath();
}
@ -175,7 +175,7 @@ void BrowserDialog::show(const string& startpath,
switch(_mode)
{
case Mode::FileLoad:
_fileList->setListMode(FilesystemNode::ListMode::All);
_fileList->setListMode(FSNode::ListMode::All);
_fileList->setNameFilter(namefilter);
_fileList->setHeight(_selected->getTop() - VGAP * 2 - _fileList->getTop());
// Show "save" checkbox
@ -192,7 +192,7 @@ void BrowserDialog::show(const string& startpath,
break;
case Mode::FileSave:
_fileList->setListMode(FilesystemNode::ListMode::All);
_fileList->setListMode(FSNode::ListMode::All);
_fileList->setNameFilter(namefilter);
_fileList->setHeight(_selected->getTop() - VGAP * 2 - _fileList->getTop());
// Show "save" checkbox
@ -211,8 +211,8 @@ void BrowserDialog::show(const string& startpath,
break;
case Mode::Directories:
_fileList->setListMode(FilesystemNode::ListMode::DirectoriesOnly);
_fileList->setNameFilter([](const FilesystemNode&) { return true; });
_fileList->setListMode(FSNode::ListMode::DirectoriesOnly);
_fileList->setNameFilter([](const FSNode&) { return true; });
// TODO: scrollbar affected too!
_fileList->setHeight(_selected->getBottom() - _fileList->getTop());
// Hide "save" checkbox
@ -230,9 +230,9 @@ void BrowserDialog::show(const string& startpath,
// Set start path
if(_mode != Mode::Directories)
_fileList->setDirectory(FilesystemNode(directory), fileName);
_fileList->setDirectory(FSNode(directory), fileName);
else
_fileList->setDirectory(FilesystemNode(startpath));
_fileList->setDirectory(FSNode(startpath));
updateUI(fileSelected);
@ -241,14 +241,14 @@ void BrowserDialog::show(const string& startpath,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const FilesystemNode& BrowserDialog::getResult() const
const FSNode& BrowserDialog::getResult() const
{
if(_mode == Mode::FileLoad || _mode == Mode::FileSave)
{
static FilesystemNode node;
static FSNode node;
return node
= FilesystemNode(_fileList->currentDir().getPath() + _selected->getText());
= FSNode(_fileList->currentDir().getPath() + _selected->getText());
}
else
return _fileList->currentDir();
@ -296,11 +296,11 @@ void BrowserDialog::handleCommand(CommandSender* sender, int cmd,
break;
case kBaseDirCmd:
_fileList->selectDirectory(FilesystemNode(instance().baseDir()));
_fileList->selectDirectory(FSNode(instance().baseDir()));
break;
case kHomeDirCmd:
_fileList->selectDirectory(FilesystemNode(instance().homeDir()));
_fileList->selectDirectory(FSNode(instance().homeDir()));
break;
case EditableWidget::kChangedCmd:

View File

@ -41,9 +41,9 @@ class BrowserDialog : public Dialog
/** Function which is run when the user clicks OK or Cancel.
Boolean parameter is passed as 'true' when OK is clicked, else 'false'.
FilesystemNode parameter is what is currently selected in the browser.
FSNode parameter is what is currently selected in the browser.
*/
using Command = std::function<void(bool, const FilesystemNode&)>;
using Command = std::function<void(bool, const FSNode&)>;
public:
// NOTE: Do not call this c'tor directly! Use the static show method below
@ -66,8 +66,8 @@ class BrowserDialog : public Dialog
const string& title, const string& startpath,
BrowserDialog::Mode mode,
const Command& command,
const FilesystemNode::NameFilter& namefilter = {
[](const FilesystemNode&) { return true; }});
const FSNode::NameFilter& namefilter = {
[](const FSNode&) { return true; }});
/**
Place the browser window onscreen, using the given attributes.
@ -83,8 +83,8 @@ class BrowserDialog : public Dialog
const string& title, const string& startpath,
BrowserDialog::Mode mode,
const Command& command,
const FilesystemNode::NameFilter& namefilter = {
[](const FilesystemNode&) { return true; } });
const FSNode::NameFilter& namefilter = {
[](const FSNode&) { return true; } });
/**
Since the show methods allocate a static BrowserDialog, at some
@ -99,10 +99,10 @@ class BrowserDialog : public Dialog
void show(const string& startpath,
BrowserDialog::Mode mode,
const Command& command,
const FilesystemNode::NameFilter& namefilter);
const FSNode::NameFilter& namefilter);
/** Get resulting file node (called after receiving kChooseCmd) */
const FilesystemNode& getResult() const;
const FSNode& getResult() const;
void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
@ -118,7 +118,7 @@ class BrowserDialog : public Dialog
// Called when the user selects OK (bool is true) or Cancel (bool is false)
// FSNode will be set to whatever is active (basically, getResult())
Command _command{[](bool, const FilesystemNode&){}};
Command _command{[](bool, const FSNode&){}};
FileListWidget* _fileList{nullptr};
NavigationWidget* _navigationBar{nullptr};

View File

@ -45,7 +45,7 @@ void FavoritesManager::load()
for (const auto& u : jUser)
{
const string& path = u.get<string>();
FilesystemNode node(path);
FSNode node(path);
if (node.exists())
addUser(path);
}
@ -69,7 +69,7 @@ void FavoritesManager::load()
for (const auto& r : jRecent)
{
const string& path = r.get<string>();
FilesystemNode node(path);
FSNode node(path);
if (node.exists())
addRecent(path);
}
@ -93,7 +93,7 @@ void FavoritesManager::load()
{
const string& path = p[0].get<string>();
const uInt32 count = p[1].get<uInt32>();
FilesystemNode node(path);
FSNode node(path);
if (node.exists())
myPopularMap.emplace(path, count);
}
@ -186,8 +186,8 @@ const FavoritesManager::UserList& FavoritesManager::userList() const
[](const string& a, const string& b)
{
// Sort without path
FilesystemNode aNode(a);
FilesystemNode bNode(b);
FSNode aNode(a);
FSNode bNode(b);
const bool realDir = aNode.isDirectory() && !BSPF::endsWithIgnoreCase(aNode.getPath(), ".zip");
if(realDir != (bNode.isDirectory() && !BSPF::endsWithIgnoreCase(bNode.getPath(), ".zip")))
@ -248,8 +248,8 @@ const FavoritesManager::RecentList& FavoritesManager::recentList() const
[](const string& a, const string& b)
{
// Sort alphabetical, without path
FilesystemNode aNode(a);
FilesystemNode bNode(b);
FSNode aNode(a);
FSNode bNode(b);
return BSPF::compareIgnoreCase(aNode.getName(), bNode.getName()) < 0;
});
@ -329,8 +329,8 @@ const FavoritesManager::PopularList& FavoritesManager::sortedPopularList(bool so
return a.second > b.second;
// 2. Sort alphabetical, without path
FilesystemNode aNode(a.first);
FilesystemNode bNode(b.first);
FSNode aNode(a.first);
FSNode bNode(b.first);
return BSPF::compareIgnoreCase(aNode.getName(), bNode.getName()) < 0;
});
return sortedList;

View File

@ -30,15 +30,14 @@
FileListWidget::FileListWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: StringListWidget(boss, font, x, y, w, h),
_filter{[](const FilesystemNode&) { return true; }}
_filter{[](const FSNode&) { return true; }}
{
// This widget is special, in that it catches signals and redirects them
setTarget(this);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FileListWidget::setDirectory(const FilesystemNode& node,
const string& select)
void FileListWidget::setDirectory(const FSNode& node, const string& select)
{
_node = node;
@ -56,7 +55,7 @@ void FileListWidget::setDirectory(const FilesystemNode& node,
}
// Initialize history
FilesystemNode tmp = _node;
FSNode tmp = _node;
string name = select;
_history.clear();
@ -77,12 +76,11 @@ void FileListWidget::setDirectory(const FilesystemNode& node,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FileListWidget::setLocation(const FilesystemNode& node,
const string select)
void FileListWidget::setLocation(const FSNode& node, const string select)
{
progress().resetProgress();
progress().open();
FilesystemNode::CancelCheck isCancelled = [this]() {
FSNode::CancelCheck isCancelled = [this]() {
return myProgressDialog->isCancelled();
};
@ -138,13 +136,13 @@ void FileListWidget::setLocation(const FilesystemNode& node,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FileListWidget::isDirectory(const FilesystemNode& node) const
bool FileListWidget::isDirectory(const FSNode& node) const
{
return node.isDirectory();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FileListWidget::getChildren(const FilesystemNode::CancelCheck& isCancelled)
void FileListWidget::getChildren(const FSNode::CancelCheck& isCancelled)
{
if(_includeSubDirs)
{
@ -162,7 +160,7 @@ void FileListWidget::getChildren(const FilesystemNode::CancelCheck& isCancelled)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileListWidget::IconType FileListWidget::getIconType(const string& path) const
{
const FilesystemNode node(path);
const FSNode node(path);
if(node.isDirectory())
{
@ -182,7 +180,7 @@ void FileListWidget::selectDirectory()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FileListWidget::selectDirectory(const FilesystemNode& node)
void FileListWidget::selectDirectory(const FSNode& node)
{
if(node.getPath() != _node.getPath())
addHistory(node);
@ -195,7 +193,7 @@ void FileListWidget::selectParent()
if(_node.hasParent())
{
string name = _node.getName();
FilesystemNode parent(_node.getParent());
FSNode parent(_node.getParent());
_currentHistory->selected = selected().getName();
addHistory(parent);
@ -247,7 +245,7 @@ bool FileListWidget::hasNextHistory()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string& FileListWidget::fixPath(string& path)
{
if(path.length() > 0 && path.back() == FilesystemNode::PATH_SEPARATOR)
if(path.length() > 0 && path.back() == FSNode::PATH_SEPARATOR)
{
path.pop_back();
if(path.length() == 2 && path.back() == ':')
@ -257,7 +255,7 @@ string& FileListWidget::fixPath(string& path)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FileListWidget::addHistory(const FilesystemNode& node)
void FileListWidget::addHistory(const FSNode& node)
{
if (_history.size() > 0) {
while(_currentHistory != std::prev(_history.end(), 1))
@ -284,7 +282,7 @@ void FileListWidget::reload()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const FilesystemNode& FileListWidget::selected()
const FSNode& FileListWidget::selected()
{
if(_fileList.size() > 0)
{
@ -731,4 +729,4 @@ string FileListWidget::getToolTip(const Common::Point& pos) const
uInt64 FileListWidget::_QUICK_SELECT_DELAY = 300;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNode FileListWidget::ourDefaultNode = FilesystemNode("~");
FSNode FileListWidget::ourDefaultNode = FSNode("~");

View File

@ -50,7 +50,7 @@ class FileListWidget : public StringListWidget
kPrevDirCmd = 'prvc', // go back in history to previous directory
kNextDirCmd = 'nxtc' // go back in history to next directory
};
using IconTypeFilter = std::function<bool(const FilesystemNode& node)>;
using IconTypeFilter = std::function<bool(const FSNode& node)>;
public:
FileListWidget(GuiObject* boss, const GUI::Font& font,
@ -63,8 +63,8 @@ class FileListWidget : public StringListWidget
/** Determines how to display files/folders; either setDirectory or reload
must be called after any of these are called. */
void setListMode(FilesystemNode::ListMode mode) { _fsmode = mode; }
void setNameFilter(const FilesystemNode::NameFilter& filter) {
void setListMode(FSNode::ListMode mode) { _fsmode = mode; }
void setNameFilter(const FSNode::NameFilter& filter) {
_filter = filter;
}
@ -81,13 +81,13 @@ class FileListWidget : public StringListWidget
will instead be used, and the file will be selected
@param select An optional entry to select (if applicable)
*/
void setDirectory(const FilesystemNode& node,
void setDirectory(const FSNode& node,
const string& select = EmptyString);
/** Descend into currently selected directory */
void selectDirectory();
/** Go to directory */
void selectDirectory(const FilesystemNode& node);
void selectDirectory(const FSNode& node);
/** Select parent directory (if applicable) */
void selectParent();
/** Check if the there is a previous directory in history */
@ -99,8 +99,8 @@ class FileListWidget : public StringListWidget
void reload();
/** Gets current node(s) */
const FilesystemNode& selected();
const FilesystemNode& currentDir() const { return _node; }
const FSNode& selected();
const FSNode& currentDir() const { return _node; }
static void setQuickSelectDelay(uInt64 time) { _QUICK_SELECT_DELAY = time; }
uInt64 getQuickSelectDelay() const { return _QUICK_SELECT_DELAY; }
@ -111,10 +111,10 @@ class FileListWidget : public StringListWidget
protected:
struct HistoryType
{
FilesystemNode node;
FSNode node;
string selected;
explicit HistoryType(const FilesystemNode& _hnode, const string& _hselected)
explicit HistoryType(const FSNode& _hnode, const string& _hselected)
: node{_hnode}, selected{_hselected} {}
};
enum class IconType {
@ -137,27 +137,27 @@ class FileListWidget : public StringListWidget
protected:
/** Very similar to setDirectory(), but also updates the history */
void setLocation(const FilesystemNode& node, const string select);
void setLocation(const FSNode& node, const string select);
/** Select to home directory */
void selectHomeDir();
/** Select previous directory in history (if applicable) */
void selectPrevHistory();
/** Select next directory in history (if applicable) */
void selectNextHistory();
virtual bool isDirectory(const FilesystemNode& node) const;
virtual void getChildren(const FilesystemNode::CancelCheck& isCancelled);
virtual bool isDirectory(const FSNode& node) const;
virtual void getChildren(const FSNode::CancelCheck& isCancelled);
virtual void extendLists(StringList& list) { }
virtual IconType getIconType(const string& path) const;
virtual const Icon* getIcon(int i) const;
int iconWidth() const;
virtual bool fullPathToolTip() const { return false; }
string& fixPath(string& path);
void addHistory(const FilesystemNode& node);
void addHistory(const FSNode& node);
protected:
FilesystemNode _node;
FSNode _node;
FSList _fileList;
FilesystemNode::NameFilter _filter;
FSNode::NameFilter _filter;
string _selectedFile;
StringList _dirList;
std::vector<HistoryType> _history;
@ -171,7 +171,7 @@ class FileListWidget : public StringListWidget
int drawIcon(int i, int x, int y, ColorId color) override;
private:
FilesystemNode::ListMode _fsmode{FilesystemNode::ListMode::All};
FSNode::ListMode _fsmode{FSNode::ListMode::All};
bool _includeSubDirs{false};
bool _showFileExtensions{true};
@ -187,7 +187,7 @@ class FileListWidget : public StringListWidget
unique_ptr<ProgressDialog> myProgressDialog;
static FilesystemNode ourDefaultNode;
static FSNode ourDefaultNode;
private:
// Following constructors and assignment operators not supported

View File

@ -703,7 +703,7 @@ void GameInfoDialog::loadConfig()
{
const string& md5 = instance().launcher().selectedRomMD5();
instance().propSet().getMD5(md5, myGameProperties);
myGameFile = FilesystemNode(instance().launcher().selectedRom());
myGameFile = FSNode(instance().launcher().selectedRom());
}
loadEmulationProperties(myGameProperties);
@ -734,7 +734,7 @@ void GameInfoDialog::loadEmulationProperties(const Properties& props)
}
else
{
const FilesystemNode& node = FilesystemNode(instance().launcher().selectedRom());
const FSNode& node = FSNode(instance().launcher().selectedRom());
ByteBuffer image;
string md5 = props.get(PropType::Cart_MD5);
size_t size = 0;
@ -1131,7 +1131,7 @@ void GameInfoDialog::updateControllerStates()
// try to load the image for auto detection
if(!instance().hasConsole())
{
const FilesystemNode& node = FilesystemNode(instance().launcher().selectedRom());
const FSNode& node = FSNode(instance().launcher().selectedRom());
autoDetect = node.exists() && !node.isDirectory() && (image = instance().openROM(node, md5, size)) != nullptr;
}
@ -1382,7 +1382,7 @@ void GameInfoDialog::setAddressVal(const EditTextWidget* addressWidget, EditText
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::exportCurrentPropertiesToDisk(const FilesystemNode& node)
void GameInfoDialog::exportCurrentPropertiesToDisk(const FSNode& node)
{
saveProperties();
@ -1414,7 +1414,7 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
instance().userDir().getPath() +
myGameFile.getNameWithExt(".pro"),
BrowserDialog::Mode::FileSave,
[this](bool OK, const FilesystemNode& node) {
[this](bool OK, const FSNode& node) {
if(OK) exportCurrentPropertiesToDisk(node);
});
break;

View File

@ -79,7 +79,7 @@ class GameInfoDialog : public Dialog, public CommandSender
// set formatted memory value for given address field
void setAddressVal(const EditTextWidget* address, EditTextWidget* val,
bool isBCD = true, bool zeroBased = false, uInt8 maxVal = 255);
void exportCurrentPropertiesToDisk(const FilesystemNode& node);
void exportCurrentPropertiesToDisk(const FSNode& node);
private:
TabWidget* myTab{nullptr};
@ -193,7 +193,7 @@ class GameInfoDialog : public Dialog, public CommandSender
// Game properties for currently loaded ROM
Properties myGameProperties;
// Filename of the currently loaded ROM
FilesystemNode myGameFile;
FSNode myGameFile;
private:
// Following constructors and assignment operators not supported

View File

@ -73,7 +73,7 @@ const string& Launcher::selectedRomMD5()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const FilesystemNode& Launcher::currentDir() const
const FSNode& Launcher::currentDir() const
{
return (static_cast<LauncherDialog*>(myBaseDialog))->currentDir();
}

View File

@ -20,7 +20,7 @@
class Properties;
class OSystem;
class FilesystemNode;
class FSNode;
#include "Rect.hxx"
#include "FrameBufferConstants.hxx"
@ -58,7 +58,7 @@ class Launcher : public DialogContainer
/**
Wrapper for LauncherDialog::currentDir() method.
*/
const FilesystemNode& currentDir() const;
const FSNode& currentDir() const;
/**
Wrapper for LauncherDialog::reload() method.

View File

@ -290,7 +290,7 @@ void LauncherDialog::addRomWidgets(int ypos)
instance().settings().setValue("startromdir", getRomDir());
myList = new LauncherFileListWidget(this, _font, xpos, ypos, listWidth, listHeight);
myList->setEditable(false);
myList->setListMode(FilesystemNode::ListMode::All);
myList->setListMode(FSNode::ListMode::All);
// since we cannot know how many files there are, use are really high value here
myList->progress().setRange(0, 50000, 5);
myList->progress().setMessage(" Filtering files" + ELLIPSIS + " ");
@ -401,13 +401,13 @@ const string& LauncherDialog::selectedRomMD5()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const FilesystemNode& LauncherDialog::currentNode() const
const FSNode& LauncherDialog::currentNode() const
{
return myList->selected();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const FilesystemNode& LauncherDialog::currentDir() const
const FSNode& LauncherDialog::currentDir() const
{
return myList->currentDir();
}
@ -471,9 +471,9 @@ void LauncherDialog::loadConfig()
// has been called (and we should reload the list)
if(myList->getList().empty())
{
FilesystemNode node(romdir == "" ? "~" : romdir);
FSNode node(romdir == "" ? "~" : romdir);
if(!myList->isDirectory(node))
node = FilesystemNode("~");
node = FSNode("~");
myList->setDirectory(node, settings.getString("lastrom"));
updateUI();
@ -601,7 +601,7 @@ bool LauncherDialog::matchWithWildcardsIgnoreCase(const string& str, const strin
void LauncherDialog::applyFiltering()
{
myList->setNameFilter(
[&](const FilesystemNode& node) {
[&](const FSNode& node) {
myList->incProgress();
if(!node.isDirectory())
{
@ -1015,10 +1015,10 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
if(myList->currentDir().getPath() != romDir)
{
FilesystemNode node(romDir);
FSNode node(romDir);
if(!myList->isDirectory(node))
node = FilesystemNode("~");
node = FSNode("~");
myList->setDirectory(node);
}

View File

@ -81,16 +81,16 @@ class LauncherDialog : public Dialog, CommandSender
/**
Get node for the currently selected entry.
@return FilesystemNode currently selected
@return FSNode currently selected
*/
const FilesystemNode& currentNode() const;
const FSNode& currentNode() const;
/**
Get node for the current directory.
@return FilesystemNode (directory) currently active
@return FSNode (directory) currently active
*/
const FilesystemNode& currentDir() const;
const FSNode& currentDir() const;
/**
Reload the current listing

View File

@ -35,7 +35,7 @@ LauncherFileListWidget::LauncherFileListWidget(GuiObject* boss, const GUI::Font&
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool LauncherFileListWidget::isDirectory(const FilesystemNode& node) const
bool LauncherFileListWidget::isDirectory(const FSNode& node) const
{
const bool isDir = node.isDirectory();
@ -49,7 +49,7 @@ bool LauncherFileListWidget::isDirectory(const FilesystemNode& node) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherFileListWidget::getChildren(const FilesystemNode::CancelCheck& isCancelled)
void LauncherFileListWidget::getChildren(const FSNode::CancelCheck& isCancelled)
{
if(_node.exists() || !_node.hasParent())
{
@ -62,7 +62,7 @@ void LauncherFileListWidget::getChildren(const FilesystemNode::CancelCheck& isCa
myInVirtualDir = true;
myVirtualDir = _node.getName();
FilesystemNode parent(_node.getParent());
FSNode parent(_node.getParent());
parent.setName("..");
_fileList.emplace_back(parent);
@ -70,10 +70,10 @@ void LauncherFileListWidget::getChildren(const FilesystemNode::CancelCheck& isCa
{
for(auto& item : myFavorites->userList())
{
FilesystemNode node(item);
FSNode node(item);
string name = node.getName();
if(name.back() == FilesystemNode::PATH_SEPARATOR)
if(name.back() == FSNode::PATH_SEPARATOR)
{
name.pop_back();
node.setName(name);
@ -86,7 +86,7 @@ void LauncherFileListWidget::getChildren(const FilesystemNode::CancelCheck& isCa
{
for(auto& item : myFavorites->popularList())
{
FilesystemNode node(item.first);
FSNode node(item.first);
if(_filter(node))
_fileList.emplace_back(node);
}
@ -95,7 +95,7 @@ void LauncherFileListWidget::getChildren(const FilesystemNode::CancelCheck& isCa
{
for(auto& item : myFavorites->recentList())
{
FilesystemNode node(item);
FSNode node(item);
if(_filter(node))
_fileList.emplace_back(node);
}
@ -107,7 +107,7 @@ void LauncherFileListWidget::getChildren(const FilesystemNode::CancelCheck& isCa
void LauncherFileListWidget::addFolder(StringList& list, int& offset, const string& name, IconType icon)
{
_fileList.insert(_fileList.begin() + offset,
FilesystemNode(_node.getPath() + name));
FSNode(_node.getPath() + name));
list.insert(list.begin() + offset, name);
_dirList.insert(_dirList.begin() + offset, "");
_iconTypeList.insert((_iconTypeList.begin() + offset), icon);
@ -118,7 +118,7 @@ void LauncherFileListWidget::addFolder(StringList& list, int& offset, const stri
string LauncherFileListWidget::startRomDir()
{
string romDir = instance().settings().getString("startromdir");
FilesystemNode node(romDir);
FSNode node(romDir);
return node.getPath();
}
@ -256,7 +256,7 @@ FileListWidget::IconType LauncherFileListWidget::getIconType(const string& path)
if(!isUserFavorite(path))
return FileListWidget::getIconType(path);
const FilesystemNode node(path);
const FSNode node(path);
if(node.isDirectory())
return BSPF::endsWithIgnoreCase(node.getName(), ".zip")
? IconType::favzip : IconType::favdir;

View File

@ -19,7 +19,7 @@
#define LAUNCHER_FILE_LIST_WIDGET_HXX
class FavoritesManager;
class FilesystemNode;
class FSNode;
class ProgressDialog;
class Settings;
@ -50,7 +50,7 @@ class LauncherFileListWidget : public FileListWidget
void removeAllPopular();
void removeAllRecent();
bool isDirectory(const FilesystemNode& node) const override;
bool isDirectory(const FSNode& node) const override;
bool inVirtualDir() const { return myInVirtualDir; }
bool inUserDir() const { return myVirtualDir == user_name; }
bool inRecentDir() const { return myVirtualDir == recent_name; }
@ -71,7 +71,7 @@ class LauncherFileListWidget : public FileListWidget
private:
string startRomDir();
void getChildren(const FilesystemNode::CancelCheck& isCancelled) override;
void getChildren(const FSNode::CancelCheck& isCancelled) override;
void userFavor(const string& path);
void addFolder(StringList& list, int& offset, const string& name, IconType icon);
void extendLists(StringList& list) override;

View File

@ -114,7 +114,7 @@ void LoggerDialog::saveConfig()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LoggerDialog::saveLogFile(const FilesystemNode& node)
void LoggerDialog::saveLogFile(const FSNode& node)
{
try
{
@ -144,7 +144,7 @@ void LoggerDialog::handleCommand(CommandSender* sender, int cmd,
BrowserDialog::show(this, _font, "Save Log as",
instance().userDir().getPath() + "stella.log",
BrowserDialog::Mode::FileSave,
[this](bool OK, const FilesystemNode& node) {
[this](bool OK, const FSNode& node) {
if(OK) saveLogFile(node);
});
break;

View File

@ -37,7 +37,7 @@ class LoggerDialog : public Dialog
private:
void loadConfig() override;
void saveConfig() override;
void saveLogFile(const FilesystemNode& node);
void saveLogFile(const FSNode& node);
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;

View File

@ -133,7 +133,7 @@ void NavigationWidget::handleCommand(CommandSender* sender, int cmd, int data, i
{
case kFolderClicked:
{
FilesystemNode node(myPath->getPath(id));
FSNode node(myPath->getPath(id));
myList->selectDirectory(node);
break;
}
@ -156,7 +156,7 @@ void NavigationWidget::PathWidget::setPath(const string& path)
{
const int fontWidth = _font.getMaxCharWidth();
int x = _x + fontWidth, w = _w;
FilesystemNode node(path);
FSNode node(path);
// Calculate how many path parts can be displayed
StringList paths;
@ -166,7 +166,7 @@ void NavigationWidget::PathWidget::setPath(const string& path)
const string& name = node.getName();
int l = static_cast<int>(name.length() + 2);
if(name.back() == FilesystemNode::PATH_SEPARATOR)
if(name.back() == FSNode::PATH_SEPARATOR)
l--;
if(node.getParent().hasParent())
l++;
@ -183,14 +183,14 @@ void NavigationWidget::PathWidget::setPath(const string& path)
for(auto it = paths.rbegin(); it != paths.rend(); ++it, ++idx)
{
const string& curPath = *it;
node = FilesystemNode(curPath);
node = FSNode(curPath);
string name = node.getName();
if(it == paths.rbegin() && cutFirst)
name = ">";
else
{
if(name.back() == FilesystemNode::PATH_SEPARATOR)
if(name.back() == FSNode::PATH_SEPARATOR)
name.pop_back();
if(it + 1 != paths.rend())
name += " >";

View File

@ -112,10 +112,10 @@ void RomAuditDialog::auditRoms()
myResults1->setText("");
myResults2->setText("");
FilesystemNode node(auditPath);
FSNode node(auditPath);
FSList files;
files.reserve(2048);
node.getChildren(files, FilesystemNode::ListMode::FilesOnly);
node.getChildren(files, FSNode::ListMode::FilesOnly);
// Create a progress dialog box to show the progress of processing
// the ROMs, since this is usually a time-consuming operation
@ -201,7 +201,7 @@ void RomAuditDialog::handleCommand(CommandSender* sender, int cmd,
BrowserDialog::show(this, _font, "Select ROM Directory to Audit",
myRomPath->getText(),
BrowserDialog::Mode::Directories,
[this](bool OK, const FilesystemNode& node) {
[this](bool OK, const FSNode& node) {
if(OK) {
myRomPath->setText(node.getShortPath());
myResults1->setText("");

View File

@ -46,7 +46,7 @@ RomInfoWidget::RomInfoWidget(GuiObject* boss, const GUI::Font& font,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomInfoWidget::setProperties(const FilesystemNode& node, const string& md5)
void RomInfoWidget::setProperties(const FSNode& node, const string& md5)
{
myHaveProperties = true;
@ -75,7 +75,7 @@ void RomInfoWidget::clearProperties()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomInfoWidget::reloadProperties(const FilesystemNode& node)
void RomInfoWidget::reloadProperties(const FSNode& node)
{
// The ROM may have changed since we were last in the browser, either
// by saving a different image or through a change in video renderer,
@ -85,7 +85,7 @@ void RomInfoWidget::reloadProperties(const FilesystemNode& node)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomInfoWidget::parseProperties(const FilesystemNode& node)
void RomInfoWidget::parseProperties(const FSNode& node)
{
// Check if a surface has ever been created; if so, we use it
// The surface will always be the maximum size, but sometimes we'll

View File

@ -40,9 +40,9 @@ class RomInfoWidget : public Widget, public CommandSender
const Common::Size& imgSize);
~RomInfoWidget() override = default;
void setProperties(const FilesystemNode& node, const string& md5);
void setProperties(const FSNode& node, const string& md5);
void clearProperties();
void reloadProperties(const FilesystemNode& node);
void reloadProperties(const FSNode& node);
const string& getUrl() const { return myUrl; }
@ -51,7 +51,7 @@ class RomInfoWidget : public Widget, public CommandSender
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
private:
void parseProperties(const FilesystemNode& node);
void parseProperties(const FSNode& node);
#ifdef PNG_SUPPORT
bool loadPng(const string& filename);
#endif

View File

@ -148,7 +148,7 @@ void SnapshotDialog::handleCommand(CommandSender* sender, int cmd,
BrowserDialog::show(this, _font, "Select Snapshot Save Directory",
mySnapSavePath->getText(),
BrowserDialog::Mode::Directories,
[this](bool OK, const FilesystemNode& node) {
[this](bool OK, const FSNode& node) {
if(OK) mySnapSavePath->setText(node.getShortPath());
});
break;

View File

@ -528,7 +528,7 @@ void StellaSettingsDialog::updateControllerStates()
// try to load the image for auto detection
if(!instance().hasConsole())
{
const FilesystemNode& node = FilesystemNode(instance().launcher().selectedRom());
const FSNode& node = FSNode(instance().launcher().selectedRom());
autoDetect = node.exists() && !node.isDirectory() && (image = instance().openROM(node, md5, size)) != nullptr;
}

View File

@ -540,7 +540,7 @@ void UIDialog::setDefaults()
break;
case 1: // Launcher options
{
FilesystemNode node("~");
FSNode node("~");
const Common::Size& size = instance().frameBuffer().desktopSize(BufferType::Launcher);
myRomPath->setText(node.getShortPath());
@ -634,7 +634,7 @@ void UIDialog::handleCommand(CommandSender* sender, int cmd, int data, int id)
BrowserDialog::show(this, _font, "Select ROM Directory",
myRomPath->getText(),
BrowserDialog::Mode::Directories,
[this](bool OK, const FilesystemNode& node) {
[this](bool OK, const FSNode& node) {
if(OK) myRomPath->setText(node.getShortPath());
});
break;
@ -647,7 +647,7 @@ void UIDialog::handleCommand(CommandSender* sender, int cmd, int data, int id)
BrowserDialog::show(this, _font, "Select ROM Info Viewer Image Directory",
mySnapLoadPath->getText(),
BrowserDialog::Mode::Directories,
[this](bool OK, const FilesystemNode& node) {
[this](bool OK, const FSNode& node) {
if(OK) mySnapLoadPath->setText(node.getShortPath());
});
break;

View File

@ -26,14 +26,14 @@
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO()
FSNodeLIBRETRO::FSNodeLIBRETRO()
: _name{"rom"},
_path{"." + slash}
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO(const string& p)
FSNodeLIBRETRO::FSNodeLIBRETRO(const string& p)
: _name{p},
_path{p}
{
@ -43,56 +43,56 @@ FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO(const string& p)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeLIBRETRO::exists() const
bool FSNodeLIBRETRO::exists() const
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeLIBRETRO::isReadable() const
bool FSNodeLIBRETRO::isReadable() const
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeLIBRETRO::isWritable() const
bool FSNodeLIBRETRO::isWritable() const
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FilesystemNodeLIBRETRO::getShortPath() const
string FSNodeLIBRETRO::getShortPath() const
{
return ".";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeLIBRETRO::
bool FSNodeLIBRETRO::
getChildren(AbstractFSList& myList, ListMode mode) const
{
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeLIBRETRO::makeDir()
bool FSNodeLIBRETRO::makeDir()
{
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeLIBRETRO::rename(const string& newfile)
bool FSNodeLIBRETRO::rename(const string& newfile)
{
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFSNodePtr FilesystemNodeLIBRETRO::getParent() const
AbstractFSNodePtr FSNodeLIBRETRO::getParent() const
{
return nullptr;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t FilesystemNodeLIBRETRO::read(ByteBuffer& image, size_t) const
size_t FSNodeLIBRETRO::read(ByteBuffer& image, size_t) const
{
image = make_unique<uInt8[]>(Cartridge::maxSize());

View File

@ -26,12 +26,12 @@
* Parts of this class are documented in the base interface class,
* AbstractFSNode.
*/
class FilesystemNodeLIBRETRO : public AbstractFSNode
class FSNodeLIBRETRO : public AbstractFSNode
{
public:
FilesystemNodeLIBRETRO();
FSNodeLIBRETRO();
explicit FilesystemNodeLIBRETRO(const string& path);
explicit FSNodeLIBRETRO(const string& path);
bool exists() const override;
const string& getName() const override { return _name; }

View File

@ -34,7 +34,7 @@ void OSystemLIBRETRO::getBaseDirectories(string& basedir, string& homedir,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemLIBRETRO::initPersistence(FilesystemNode& basedir)
void OSystemLIBRETRO::initPersistence(FSNode& basedir)
{
}

View File

@ -57,7 +57,7 @@ class OSystemLIBRETRO : public OSystem
protected:
void initPersistence(FilesystemNode& basedir) override;
void initPersistence(FSNode& basedir) override;
string describePresistence() override;
};

View File

@ -92,7 +92,7 @@ bool StellaLIBRETRO::create(bool logging)
settings.setValue(AudioSettings::SETTING_VOLUME, 100);
settings.setValue(AudioSettings::SETTING_STEREO, audio_mode);
FilesystemNode rom(rom_path);
FSNode rom(rom_path);
if(myOSystem->createConsole(rom) != EmptyString)
return false;

View File

@ -29,9 +29,9 @@ void OSystemMACOS::getBaseDirectories(string& basedir, string& homedir,
if(useappdir)
cout << "ERROR: base dir in app folder not supported" << endl;
else if(usedir != "")
basedir = FilesystemNode(usedir).getPath();
basedir = FSNode(usedir).getPath();
#endif
FilesystemNode desktop("~/Desktop/");
FSNode desktop("~/Desktop/");
homedir = desktop.isDirectory() ? desktop.getShortPath() : "~/";
}

View File

@ -108,14 +108,14 @@ StringList SerialPortMACOS::portNames()
};
// Get all possible devices in the '/dev' directory
const FilesystemNode::NameFilter filter = [](const FilesystemNode& node) {
const FSNode::NameFilter filter = [](const FSNode& node) {
return BSPF::startsWithIgnoreCase(node.getPath(), "/dev/cu.usb");
};
FSList portList;
portList.reserve(5);
FilesystemNode dev("/dev/");
dev.getChildren(portList, FilesystemNode::ListMode::All, filter, false);
FSNode dev("/dev/");
dev.getChildren(portList, FSNode::ListMode::All, filter, false);
// Add only those that can be opened
for(const auto& port: portList)

View File

@ -24,14 +24,14 @@
#include "FSNodePOSIX.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodePOSIX::FilesystemNodePOSIX()
FSNodePOSIX::FSNodePOSIX()
: _path{ROOT_DIR},
_displayName{_path}
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodePOSIX::FilesystemNodePOSIX(const string& path, bool verify)
FSNodePOSIX::FSNodePOSIX(const string& path, bool verify)
: _path{path.length() > 0 ? path : "~"} // Default to home directory
{
// Expand '~' to the HOME environment variable
@ -56,7 +56,7 @@ FilesystemNodePOSIX::FilesystemNodePOSIX(const string& path, bool verify)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FilesystemNodePOSIX::setFlags()
void FSNodePOSIX::setFlags()
{
struct stat st;
@ -75,7 +75,7 @@ void FilesystemNodePOSIX::setFlags()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FilesystemNodePOSIX::getShortPath() const
string FSNodePOSIX::getShortPath() const
{
// If the path starts with the home directory, replace it with '~'
const char* env_home = std::getenv("HOME");
@ -93,13 +93,13 @@ string FilesystemNodePOSIX::getShortPath() const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodePOSIX::hasParent() const
bool FSNodePOSIX::hasParent() const
{
return _path != "" && _path != ROOT_DIR;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) const
bool FSNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) const
{
assert(_isDirectory);
@ -120,7 +120,7 @@ bool FilesystemNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) con
newPath += '/';
newPath += dp->d_name;
FilesystemNodePOSIX entry(newPath, false);
FSNodePOSIX entry(newPath, false);
#if defined(SYSTEM_NOT_SUPPORTING_D_TYPE)
/* TODO: d_type is not part of POSIX, so it might not be supported
@ -169,11 +169,11 @@ bool FilesystemNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) con
continue;
// Honor the chosen mode
if ((mode == FilesystemNode::ListMode::FilesOnly && !entry._isFile) ||
(mode == FilesystemNode::ListMode::DirectoriesOnly && !entry._isDirectory))
if ((mode == FSNode::ListMode::FilesOnly && !entry._isFile) ||
(mode == FSNode::ListMode::DirectoriesOnly && !entry._isDirectory))
continue;
myList.emplace_back(make_shared<FilesystemNodePOSIX>(entry));
myList.emplace_back(make_shared<FSNodePOSIX>(entry));
}
closedir(dirp);
@ -181,14 +181,14 @@ bool FilesystemNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) con
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t FilesystemNodePOSIX::getSize() const
size_t FSNodePOSIX::getSize() const
{
struct stat st;
return (stat(_path.c_str(), &st) == 0) ? st.st_size : 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodePOSIX::makeDir()
bool FSNodePOSIX::makeDir()
{
if(mkdir(_path.c_str(), 0777) == 0)
{
@ -211,7 +211,7 @@ bool FilesystemNodePOSIX::makeDir()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodePOSIX::rename(const string& newfile)
bool FSNodePOSIX::rename(const string& newfile)
{
if(std::rename(_path.c_str(), newfile.c_str()) == 0)
{
@ -236,7 +236,7 @@ bool FilesystemNodePOSIX::rename(const string& newfile)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFSNodePtr FilesystemNodePOSIX::getParent() const
AbstractFSNodePtr FSNodePOSIX::getParent() const
{
if (_path == ROOT_DIR)
return nullptr;
@ -244,5 +244,5 @@ AbstractFSNodePtr FilesystemNodePOSIX::getParent() const
const char* start = _path.c_str();
const char* end = lastPathComponent(_path);
return make_unique<FilesystemNodePOSIX>(string(start, size_t(end - start)));
return make_unique<FSNodePOSIX>(string(start, size_t(end - start)));
}

View File

@ -43,22 +43,22 @@
*
* Parts of this class are documented in the base interface class, AbstractFSNode.
*/
class FilesystemNodePOSIX : public AbstractFSNode
class FSNodePOSIX : public AbstractFSNode
{
public:
/**
* Creates a FilesystemNodePOSIX with the root node as path.
* Creates a FSNodePOSIX with the root node as path.
*/
FilesystemNodePOSIX();
FSNodePOSIX();
/**
* Creates a FilesystemNodePOSIX for a given path.
* Creates a FSNodePOSIX for a given path.
*
* @param path String with the path the new node should point to.
* @param verify true if the isValid and isDirectory/isFile flags should
* be verified during the construction.
*/
explicit FilesystemNodePOSIX(const string& path, bool verify = true);
explicit FSNodePOSIX(const string& path, bool verify = true);
bool exists() const override { return access(_path.c_str(), F_OK) == 0; }
const string& getName() const override { return _displayName; }

View File

@ -35,5 +35,5 @@ void OSystemUNIX::getBaseDirectories(string& basedir, string& homedir,
if(useappdir)
cout << "ERROR: base dir in app folder not supported" << endl;
else if(usedir != "")
basedir = FilesystemNode(usedir).getPath();
basedir = FSNode(usedir).getPath();
}

View File

@ -111,15 +111,15 @@ StringList SerialPortUNIX::portNames()
};
// Get all possible devices in the '/dev' directory
const FilesystemNode::NameFilter filter = [](const FilesystemNode& node) {
const FSNode::NameFilter filter = [](const FSNode& node) {
return BSPF::startsWithIgnoreCase(node.getPath(), "/dev/ttyACM") ||
BSPF::startsWithIgnoreCase(node.getPath(), "/dev/ttyUSB");
};
FSList portList;
portList.reserve(5);
FilesystemNode dev("/dev/");
dev.getChildren(portList, FilesystemNode::ListMode::All, filter, false);
FSNode dev("/dev/");
dev.getChildren(portList, FSNode::ListMode::All, filter, false);
// Add only those that can be opened
for(const auto& port: portList)

View File

@ -40,25 +40,25 @@
#include "FSNodeWINDOWS.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeWINDOWS::exists() const
bool FSNodeWINDOWS::exists() const
{
return _access(_path.c_str(), F_OK) == 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeWINDOWS::isReadable() const
bool FSNodeWINDOWS::isReadable() const
{
return _access(_path.c_str(), R_OK) == 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeWINDOWS::isWritable() const
bool FSNodeWINDOWS::isWritable() const
{
return _access(_path.c_str(), W_OK) == 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FilesystemNodeWINDOWS::setFlags()
void FSNodeWINDOWS::setFlags()
{
// Get absolute path
TCHAR buf[4096];
@ -88,10 +88,10 @@ void FilesystemNodeWINDOWS::setFlags()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FilesystemNodeWINDOWS::addFile(AbstractFSList& list, ListMode mode,
void FSNodeWINDOWS::addFile(AbstractFSList& list, ListMode mode,
const char* base, WIN32_FIND_DATA* find_data)
{
FilesystemNodeWINDOWS entry;
FSNodeWINDOWS entry;
const char* const asciiName = toAscii(find_data->cFileName);
bool isDirectory = false, isFile = false;
@ -102,8 +102,8 @@ void FilesystemNodeWINDOWS::addFile(AbstractFSList& list, ListMode mode,
isDirectory = ((find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
isFile = !isDirectory;//(find_data->dwFileAttributes & FILE_ATTRIBUTE_NORMAL ? true : false);
if((isFile && mode == FilesystemNode::ListMode::DirectoriesOnly) ||
(isDirectory && mode == FilesystemNode::ListMode::FilesOnly))
if((isFile && mode == FSNode::ListMode::DirectoriesOnly) ||
(isDirectory && mode == FSNode::ListMode::FilesOnly))
return;
entry._isDirectory = isDirectory;
@ -116,11 +116,11 @@ void FilesystemNodeWINDOWS::addFile(AbstractFSList& list, ListMode mode,
entry._isValid = true;
entry._isPseudoRoot = false;
list.emplace_back(make_shared<FilesystemNodeWINDOWS>(entry));
list.emplace_back(make_shared<FSNodeWINDOWS>(entry));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
char* FilesystemNodeWINDOWS::toAscii(TCHAR* str)
char* FSNodeWINDOWS::toAscii(TCHAR* str)
{
#ifndef UNICODE
return str;
@ -132,7 +132,7 @@ char* FilesystemNodeWINDOWS::toAscii(TCHAR* str)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const TCHAR* FilesystemNodeWINDOWS::toUnicode(const char* str)
const TCHAR* FSNodeWINDOWS::toUnicode(const char* str)
{
#ifndef UNICODE
return str;
@ -144,12 +144,12 @@ const TCHAR* FilesystemNodeWINDOWS::toUnicode(const char* str)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeWINDOWS::FilesystemNodeWINDOWS()
FSNodeWINDOWS::FSNodeWINDOWS()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeWINDOWS::FilesystemNodeWINDOWS(const string& p)
FSNodeWINDOWS::FSNodeWINDOWS(const string& p)
: _path{p.length() > 0 ? p : "~"} // Default to home directory
{
// Expand '~' to the users 'home' directory
@ -160,7 +160,7 @@ FilesystemNodeWINDOWS::FilesystemNodeWINDOWS(const string& p)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FilesystemNodeWINDOWS::getShortPath() const
string FSNodeWINDOWS::getShortPath() const
{
// If the path starts with the home directory, replace it with '~'
const string& home = myHomeFinder.getHomePath();
@ -176,7 +176,7 @@ string FilesystemNodeWINDOWS::getShortPath() const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeWINDOWS::
bool FSNodeWINDOWS::
getChildren(AbstractFSList& myList, ListMode mode) const
{
assert(_isDirectory);
@ -190,7 +190,7 @@ bool FilesystemNodeWINDOWS::
for(TCHAR *current_drive = drive_buffer; *current_drive;
current_drive += _tcslen(current_drive) + 1)
{
FilesystemNodeWINDOWS entry;
FSNodeWINDOWS entry;
char drive_name[2] = { 0, 0 };
drive_name[0] = toAscii(current_drive)[0];
@ -201,7 +201,7 @@ bool FilesystemNodeWINDOWS::
entry._isValid = true;
entry._isPseudoRoot = false;
entry._path = toAscii(current_drive);
myList.emplace_back(make_shared<FilesystemNodeWINDOWS>(entry));
myList.emplace_back(make_shared<FSNodeWINDOWS>(entry));
}
}
else
@ -229,14 +229,14 @@ bool FilesystemNodeWINDOWS::
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t FilesystemNodeWINDOWS::getSize() const
size_t FSNodeWINDOWS::getSize() const
{
struct _stat st;
return _stat(_path.c_str(), &st) == 0 ? st.st_size : 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeWINDOWS::makeDir()
bool FSNodeWINDOWS::makeDir()
{
if(!_isPseudoRoot && CreateDirectory(_path.c_str(), NULL) != 0)
{
@ -248,7 +248,7 @@ bool FilesystemNodeWINDOWS::makeDir()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeWINDOWS::rename(const string& newfile)
bool FSNodeWINDOWS::rename(const string& newfile)
{
if(!_isPseudoRoot && MoveFile(_path.c_str(), newfile.c_str()) != 0)
{
@ -260,7 +260,7 @@ bool FilesystemNodeWINDOWS::rename(const string& newfile)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFSNodePtr FilesystemNodeWINDOWS::getParent() const
AbstractFSNodePtr FSNodeWINDOWS::getParent() const
{
if(_isPseudoRoot)
return nullptr;
@ -270,8 +270,8 @@ AbstractFSNodePtr FilesystemNodeWINDOWS::getParent() const
const char* start = _path.c_str();
const char* end = lastPathComponent(_path);
return make_shared<FilesystemNodeWINDOWS>(string(start, static_cast<size_t>(end - start)));
return make_shared<FSNodeWINDOWS>(string(start, static_cast<size_t>(end - start)));
}
else
return make_shared<FilesystemNodeWINDOWS>();
return make_shared<FSNodeWINDOWS>();
}

View File

@ -34,19 +34,19 @@ static HomeFinder myHomeFinder;
* Parts of this class are documented in the base interface class,
* AbstractFSNode.
*/
class FilesystemNodeWINDOWS : public AbstractFSNode
class FSNodeWINDOWS : public AbstractFSNode
{
public:
/**
* Creates a FilesystemNodeWINDOWS with the root node as path.
* Creates a FSNodeWINDOWS with the root node as path.
*
* In regular windows systems, a virtual root path is used "".
* In windows CE, the "\" root is used instead.
*/
FilesystemNodeWINDOWS();
FSNodeWINDOWS();
/**
* Creates a FilesystemNodeWINDOWS for a given path.
* Creates a FSNodeWINDOWS for a given path.
*
* Examples:
* path=c:\foo\bar.txt, currentDir=false -> c:\foo\bar.txt
@ -55,7 +55,7 @@ class FilesystemNodeWINDOWS : public AbstractFSNode
*
* @param path String with the path the new node should point to.
*/
explicit FilesystemNodeWINDOWS(const string& path);
explicit FSNodeWINDOWS(const string& path);
bool exists() const override;
const string& getName() const override { return _displayName; }
@ -90,7 +90,7 @@ class FilesystemNodeWINDOWS : public AbstractFSNode
void setFlags();
/**
* Adds a single FilesystemNodeWINDOWS to a given list.
* Adds a single FSNodeWINDOWS to a given list.
* This method is used by getChildren() to populate the directory entries list.
*
* @param list List to put the file entry node in.

View File

@ -26,7 +26,7 @@ void OSystemWINDOWS::getBaseDirectories(string& basedir, string& homedir,
bool useappdir, const string& usedir)
{
HomeFinder homefinder;
FilesystemNode appdata(homefinder.getAppDataPath());
FSNode appdata(homefinder.getAppDataPath());
if(appdata.isDirectory())
{
@ -36,7 +36,7 @@ void OSystemWINDOWS::getBaseDirectories(string& basedir, string& homedir,
basedir += "Stella\\";
}
FilesystemNode defaultHomeDir(homefinder.getDesktopPath());
FSNode defaultHomeDir(homefinder.getDesktopPath());
homedir = defaultHomeDir.getShortPath();
// Check to see if basedir overrides are active
@ -44,12 +44,12 @@ void OSystemWINDOWS::getBaseDirectories(string& basedir, string& homedir,
{
char filename[MAX_PATH];
GetModuleFileNameA(NULL, filename, sizeof(filename));
FilesystemNode appdir(filename);
FSNode appdir(filename);
appdir = appdir.getParent();
if(appdir.isDirectory())
basedir = appdir.getPath();
}
else if(usedir != "")
basedir = FilesystemNode(usedir).getPath();
basedir = FSNode(usedir).getPath();
}