Various fixes for suggestions from cppcheck.

This commit is contained in:
Stephen Anthony 2020-12-18 19:25:27 -03:30
parent 0c0d838a37
commit 2d78828677
43 changed files with 84 additions and 115 deletions

View File

@ -92,7 +92,7 @@ namespace HSM {
class HighScoresManager
{
public:
HighScoresManager(OSystem& osystem);
explicit HighScoresManager(OSystem& osystem);
virtual ~HighScoresManager() = default;

View File

@ -65,7 +65,7 @@ class PaletteHandler
};
public:
PaletteHandler(OSystem& system);
explicit PaletteHandler(OSystem& system);
/**
Cycle through available palettes.

View File

@ -273,7 +273,7 @@ void SoundSDL2::adjustVolume(int direction)
if(percent > 0 && !enabled)
{
setEnabled(!enabled);
setEnabled(true);
myOSystem.console().initializeAudio();
}

View File

@ -105,14 +105,12 @@ VideoModeHandler::Mode::Mode(uInt32 iw, uInt32 ih, Stretch smode,
VideoModeHandler::Mode::Mode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh,
Stretch smode, Int32 fsindex, const string& desc,
float zoomLevel, float overscan)
: stretch(smode),
: screenS(sw, sh),
stretch(smode),
description(desc),
zoom(zoomLevel),
fsIndex(fsindex)
{
// First set default size and positioning
screenS = Common::Size(sw, sh);
// Now resize based on windowed/fullscreen mode and stretch factor
if(fsIndex != -1) // fullscreen mode
{

View File

@ -192,7 +192,7 @@ void NTSCFilter::getAdjustables(Adjustable& adjustable, Preset preset) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void NTSCFilter::setCustomAdjustables(Adjustable& adjustable)
void NTSCFilter::setCustomAdjustables(const Adjustable& adjustable)
{
#ifdef BLARGG_PALETTE
//myCustomSetup.hue = scaleFrom100(adjustable.hue);

View File

@ -90,7 +90,7 @@ class NTSCFilter
// Set custom adjustables to given values
// Values will be scaled to 0 - 100 range, independent of how
// they're actually stored internally
void setCustomAdjustables(Adjustable& adjustable);
void setCustomAdjustables(const Adjustable& adjustable);
// The following methods cycle through each custom adjustable
// They are used in conjunction with the increase/decrease

View File

@ -1516,7 +1516,7 @@ CartDebug::AddrType CartDebug::addressType(uInt16 addr) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartDebug::getBankDirectives(ostream& buf, BankInfo& info) const
void CartDebug::getBankDirectives(ostream& buf, const BankInfo& info) const
{
// Start with the offset for this bank
buf << "ORG " << Base::HEX4 << info.offset << endl;

View File

@ -324,7 +324,7 @@ class CartDebug : public DebuggerSystem
// Analyze of bank of ROM, generating a list of Distella directives
// based on its disassembly
void getBankDirectives(ostream& buf, BankInfo& info) const;
void getBankDirectives(ostream& buf, const BankInfo& info) const;
// Get access enum type from 'flags', taking precendence into account
Device::AccessType accessTypeAbsolute(Device::AccessFlags flags) const;

View File

@ -716,10 +716,8 @@ bool Debugger::addFunction(const string& name, const string& definition,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::isBuiltinFunction(const string& name)
{
for(const auto& func: ourBuiltinFunctions)
if(name == func.name)
return true;
return false;
return std::any_of(ourBuiltinFunctions.cbegin(), ourBuiltinFunctions.cend(),
[&](const auto& func) { return name == func.name; });
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -75,7 +75,6 @@ CartridgeBUSWidget::CartridgeBUSWidget(
ypos += myLineHeight + 4;
new StaticTextWidget(boss, _font, xpos, ypos, lwidth,
myFontHeight, "Datastream Pointers", TextAlign::Left);
xpos += lwidth;
myDatastreamPointers = new DataGridWidget(boss, _nfont, DS_X, ypos+myLineHeight-2, 4, 4, 6, 32, Common::Base::Fmt::_16_3_2);
myDatastreamPointers->setTarget(this);

View File

@ -68,11 +68,10 @@ CartridgeDPCWidget::CartridgeDPCWidget(
ypos += myLineHeight + V_GAP * 3;
// Data fetchers
int lwidth = _font.getStringWidth("Data fetchers ");
new StaticTextWidget(boss, _font, xpos, ypos, "Data fetchers ");
// Top registers
lwidth = _font.getStringWidth("Counter registers ");
int lwidth = _font.getStringWidth("Counter registers ");
xpos = 2 + _font.getMaxCharWidth() * 2; ypos += myLineHeight + 4;
new StaticTextWidget(boss, _font, xpos, ypos, "Top registers ");
xpos += lwidth;

View File

@ -42,7 +42,6 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
+ COLUMN_GAP + lfont.getStringWidth("Scanline262262")
+ EditTextWidget::calcWidth(lfont) * 3 <= max_w;
const int lineHeight = lfont.getLineHeight();
int xpos = x, ypos = y + VBORDER;
int lwidth = lfont.getStringWidth(longstr ? "Frame Cycls" : "F. Cycls");
int lwidth8 = lwidth - lfont.getMaxCharWidth() * 3;
int lwidthR = lfont.getStringWidth(longstr ? "Frame Cnt." : "Frame ");
@ -57,7 +56,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
// Left column
// Left: Frame Cycle
xpos = x;
int xpos = x, ypos = y + VBORDER;
new StaticTextWidget(boss, lfont, xpos, ypos + 1, longstr ? "Frame Cycls" : "F. Cycls");
myFrameCycles = new EditTextWidget(boss, nfont, xpos + lwidth, ypos - 1, fwidth, lineHeight);
myFrameCycles->setToolTip("CPU cycles executed this frame.");

View File

@ -24,9 +24,9 @@
AtariVox::AtariVox(Jack jack, const Event& event, const System& system,
const string& portname, const FilesystemNode& eepromfile,
const onMessageCallback& callback)
: SaveKey(jack, event, system, eepromfile, callback, Controller::Type::AtariVox)
: SaveKey(jack, event, system, eepromfile, callback, Controller::Type::AtariVox),
mySerialPort(MediaFactory::createSerialPort())
{
mySerialPort = MediaFactory::createSerialPort();
if(mySerialPort->openPort(portname))
{
myCTSFlip = !mySerialPort->isCTS();

View File

@ -62,7 +62,7 @@ class FrameBuffer
};
public:
FrameBuffer(OSystem& osystem);
explicit FrameBuffer(OSystem& osystem);
~FrameBuffer();
/**

View File

@ -746,7 +746,7 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
if (!myConsole) return 0.;
TIA& tia(myConsole->tia());
EmulationTiming& timing(myConsole->emulationTiming());
const EmulationTiming& timing = myConsole->emulationTiming();
DispatchResult dispatchResult;
// Check whether we have a frame pending for rendering...
@ -758,8 +758,8 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
tia.renderToFrameBuffer();
}
// Start emulation on a dedicated thread. It will do its own scheduling to sync 6507 and real time
// and will run until we stop the worker.
// Start emulation on a dedicated thread. It will do its own scheduling to
// sync 6507 and real time and will run until we stop the worker.
emulationWorker.start(
timing.cyclesPerSecond(),
timing.maxCyclesPerTimeslice(),
@ -768,8 +768,8 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
&tia
);
// Render the frame. This may block, but emulation will continue to run on the worker, so the
// audio pipeline is kept fed :)
// Render the frame. This may block, but emulation will continue to run on
// the worker, so the audio pipeline is kept fed :)
if (framePending) myFrameBuffer->updateInEmulationMode(myFpsMeter.fps());
// Stop the worker and wait until it has finished
@ -805,11 +805,13 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
}
// Handle frying
if (dispatchResult.getStatus() == DispatchResult::Status::ok && myEventHandler->frying())
if (dispatchResult.getStatus() == DispatchResult::Status::ok &&
myEventHandler->frying())
myConsole->fry();
// Return the 6507 time used in seconds
return static_cast<double>(totalCycles) / static_cast<double>(timing.cyclesPerSecond());
return static_cast<double>(totalCycles) /
static_cast<double>(timing.cyclesPerSecond());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -23,7 +23,6 @@ using std::ios_base;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serializer::Serializer(const string& filename, Mode m)
: myStream(nullptr)
{
if(m == Mode::ReadOnly)
{
@ -66,10 +65,8 @@ Serializer::Serializer(const string& filename, Mode m)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serializer::Serializer()
: myStream(nullptr)
: myStream{make_unique<stringstream>(ios::in | ios::out | ios::binary)}
{
myStream = make_unique<stringstream>(ios::in | ios::out | ios::binary);
// For some reason, Windows and possibly macOS needs to store something in
// the stream before it is used for the first time
if(myStream)

View File

@ -49,7 +49,7 @@ class Serializer
The valid() method must immediately be called to verify the stream
was correctly initialized.
*/
Serializer(const string& filename, Mode m = Mode::ReadWrite);
explicit Serializer(const string& filename, Mode m = Mode::ReadWrite);
Serializer();
public:

View File

@ -33,9 +33,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Settings::Settings()
: myRespository(make_shared<KeyValueRepositoryNoop>())
{
myRespository = make_shared<KeyValueRepositoryNoop>();
// If no version is recorded with the persisted settings, we set it to zero
setPermanent(SETTINGS_VERSION_KEY, 0);
setPermanent("stella.version", "6.2.1");

View File

@ -43,7 +43,6 @@ void Missile::reset()
myColor = myObjectColor = myDebugColor = 0;
myDebugEnabled = false;
collision = myCollisionMaskDisabled;
myIsEnabled = false;
myInvertedPhaseClock = false;
myUseInvertedPhaseClock = false;
}

View File

@ -300,7 +300,7 @@ void Dialog::addFocusWidget(Widget* w)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::addToFocusList(WidgetArray& list)
void Dialog::addToFocusList(const WidgetArray& list)
{
// All focusable widgets should retain focus
for(const auto& w: list)
@ -314,7 +314,7 @@ void Dialog::addToFocusList(WidgetArray& list)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::addToFocusList(WidgetArray& list, TabWidget* w, int tabId)
void Dialog::addToFocusList(const WidgetArray& list, TabWidget* w, int tabId)
{
// Only add the list if the tab actually exists
if(!w || w->getID() >= _myTabList.size())

View File

@ -71,9 +71,9 @@ class Dialog : public GuiObject
void tick() override;
void addFocusWidget(Widget* w) override;
void addToFocusList(WidgetArray& list) override;
void addToFocusList(WidgetArray& list, TabWidget* w, int tabId);
void addBGroupToFocusList(WidgetArray& list) { _buttonGroup = list; }
void addToFocusList(const WidgetArray& list) override;
void addToFocusList(const WidgetArray& list, TabWidget* w, int tabId);
void addBGroupToFocusList(const WidgetArray& list) { _buttonGroup = list; }
void addTabWidget(TabWidget* w);
void addDefaultWidget(Widget* w) { _defaultWidget = w; }
void addOKWidget(Widget* w) { _okWidget = w; }

View File

@ -30,16 +30,15 @@ EditableWidget::EditableWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, const string& str)
: Widget(boss, font, x, y, w, h),
CommandSender(boss),
_editString(str),
_filter([](char c) { return isprint(c) && c != '\"'; })
_editString{str},
myUndoHandler{make_unique<UndoHandler>()},
_filter{[](char c) { return isprint(c) && c != '\"'; }}
{
_bgcolor = kWidColor;
_bgcolorhi = kWidColor;
_bgcolorlo = kDlgColor;
_textcolor = kTextColor;
_textcolorhi = kTextColor;
myUndoHandler = make_unique<UndoHandler>();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -359,13 +358,10 @@ void EditableWidget::drawCaretSelection()
{
FBSurface& s = _boss->dialog().surface();
const Common::Rect& editRect = getEditRect();
int x = editRect.x();
int y = editRect.y();
string text = selectString();
x = editRect.x();
y = editRect.y();
int x = editRect.x();
int y = editRect.y();
int w = editRect.w();
int h = editRect.h();
int wt = int(text.length()) * _font.getMaxCharWidth() + 1;

View File

@ -18,6 +18,8 @@
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
#include <numeric>
#include "Font.hxx"
namespace GUI {
@ -53,13 +55,8 @@ int Font::getStringWidth(const string& str) const
if(!myFontDesc.width)
return myFontDesc.maxwidth * int(str.size());
else
{
int space = 0;
for(auto c: str)
space += getCharWidth(c);
return space;
}
return std::accumulate(str.cbegin(), str.cend(), 0,
[&](int x, char c) { return x + getCharWidth(c); });
}
} // namespace GUI

View File

@ -130,7 +130,7 @@ class GuiObject : public CommandReceiver
/** Add given widget(s) to the focus list */
virtual void addFocusWidget(Widget* w) = 0;
virtual void addToFocusList(WidgetArray& list) = 0;
virtual void addToFocusList(const WidgetArray& list) = 0;
/** Return focus list for this object */
WidgetArray& getFocusList() { return _focusList; }

View File

@ -100,12 +100,9 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent,
int max_w, int max_h,
Menu::AppMode mode)
: Dialog(osystem, parent, osystem.frameBuffer().font(), "High Scores"),
myDirty(false),
myHighScoreSaved(false),
_max_w(max_w),
_max_h(max_h),
myInitials(""),
myMode(mode)
_max_w{max_w},
_max_h{max_h},
myMode{mode}
{
myScores.variation = HSM::DEFAULT_VARIATION;

View File

@ -76,16 +76,17 @@ class HighScoresDialog : public Dialog
};
private:
bool myUserDefVar; // allow the user to define the variation
bool myDirty;
bool myHighScoreSaved; // remember if current high score was already saved (avoids double HS)
bool myUserDefVar{false}; // allow the user to define the variation
bool myDirty{false};
bool myHighScoreSaved{false}; // remember if current high score was already saved
// (avoids double HS)
unique_ptr<GUI::MessageBox> myConfirmMsg;
int _max_w;
int _max_h;
int _max_w{0};
int _max_h{0};
string myInitials;
Int32 myEditRank;
Int32 myHighScoreRank;
Int32 myEditRank{-1};
Int32 myHighScoreRank{-1};
string myNow;
HSM::ScoresData myScores;
@ -120,4 +121,5 @@ class HighScoresDialog : public Dialog
HighScoresDialog& operator=(const HighScoresDialog&) = delete;
HighScoresDialog& operator=(HighScoresDialog&&) = delete;
};
#endif

View File

@ -27,9 +27,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Launcher::Launcher(OSystem& osystem)
: DialogContainer(osystem)
: DialogContainer(osystem),
mySize(myOSystem.settings().getSize("launcherres"))
{
mySize = myOSystem.settings().getSize("launcherres");
const Common::Size& d = myOSystem.frameBuffer().desktopSize();
double overscan = 1 - myOSystem.settings().getInt("tia.fs_overscan") / 100.0;

View File

@ -139,7 +139,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
lblSelect = "";
int lwSelectShort = font.getStringWidth(lblSelect);
wTotal -= lwSelect - lwSelectShort;
// wTotal -= lwSelect - lwSelectShort; // dead code
lwSelect = lwSelectShort;
noSelect = true;
}

View File

@ -65,8 +65,7 @@ R77HelpDialog::R77HelpDialog(OSystem& osystem, DialogContainer& parent,
myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - HBORDER * 2, fontHeight,
"", TextAlign::Center);
int jwidth = 11 * fontWidth;
int bwidth = 11 * fontWidth;
const int jwidth = 11 * fontWidth, bwidth = jwidth;
xpos = HBORDER; ypos += lineHeight + 4;
for (uInt8 i = 0; i < LINES_PER_PAGE; ++i)
{

View File

@ -221,13 +221,13 @@ RadioButtonWidget::RadioButtonWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, const string& label,
RadioButtonGroup* group, int cmd)
: CheckboxWidget(boss, font, x, y, label, cmd),
myGroup(group)
myGroup(group),
_buttonSize(buttonSize(font)) // 14 | 22
{
_flags = Widget::FLAG_ENABLED;
_bgcolor = _bgcolorhi = kWidColor;
_editable = true;
_buttonSize = buttonSize(font); // 14 | 22
if(_buttonSize == 14)
{

View File

@ -81,7 +81,7 @@ class TabWidget : public Widget, public CommandSender
bool enabled{true};
int tabWidth{0};
Tab(const string& t, int tw = NO_WIDTH,
explicit Tab(const string& t, int tw = NO_WIDTH,
Widget* first = nullptr, Widget* parent = nullptr, bool e = true)
: title(t), firstWidget(first), parentWidget(parent), enabled(e), tabWidth(tw) { }
};

View File

@ -59,7 +59,7 @@ class VideoAudioDialog : public Dialog
void handleOverscanChange();
void handlePhosphorChange();
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
void addPalette(int x, int y, int h, int w);
void addPalette(int x, int y, int w, int h);
void colorPalette();
void updatePreset();
void updateEnabledState();

View File

@ -138,11 +138,9 @@ void Widget::draw()
// Now perform the actual widget draw
drawWidget((_flags & Widget::FLAG_HILITED) ? true : false);
// Restore x/y
// Restore w/hy
if(hasBorder())
{
_x -= 4;
_y -= 4;
_w += 8;
_h += 8;
}
@ -284,13 +282,10 @@ bool Widget::isWidgetInChain(Widget* w, Widget* find)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Widget::isWidgetInChain(WidgetArray& list, Widget* find)
bool Widget::isWidgetInChain(const WidgetArray& list, Widget* find)
{
for(const auto& w: list)
if(w == find)
return true;
return false;
return std::any_of(list.cbegin(), list.cend(),
[&](Widget* w) { return w == find; });
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -83,7 +83,7 @@ class Widget : public GuiObject
void receivedFocus();
void lostFocus();
void addFocusWidget(Widget* w) override { _focusList.push_back(w); }
void addToFocusList(WidgetArray& list) override {
void addToFocusList(const WidgetArray& list) override {
Vec::append(_focusList, list);
}
@ -157,7 +157,7 @@ class Widget : public GuiObject
static bool isWidgetInChain(Widget* start, Widget* find);
/** Determine if 'find' is in the widget array */
static bool isWidgetInChain(WidgetArray& list, Widget* find);
static bool isWidgetInChain(const WidgetArray& list, Widget* find);
/** Select either previous, current, or next widget in chain to have
focus, and deselects all others */

View File

@ -15,7 +15,6 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include "OSystem.hxx"
#include "EventHandlerLIBRETRO.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -19,15 +19,13 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FBSurfaceLIBRETRO::FBSurfaceLIBRETRO(uInt32 width, uInt32 height)
: myWidth{width},
myHeight{height},
myPixelData{make_unique<uInt32[]>(myWidth * myHeight)}
{
myWidth = width;
myHeight = height;
myPixelData = make_unique<uInt32[]>(width * height);
////////////////////////////////////////////////////
// These *must* be set for the parent class
myPixels = myPixelData.get();
myPitch = width;
myPitch = myWidth;
////////////////////////////////////////////////////
}

View File

@ -64,8 +64,8 @@ class FBSurfaceLIBRETRO : public FBSurface
void applyAttributes() override { }
private:
unique_ptr<uInt32[]> myPixelData;
uInt32 myWidth, myHeight;
unique_ptr<uInt32[]> myPixelData;
Common::Rect mySrcGUIR, myDstGUIR;
private:

View File

@ -27,15 +27,15 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO()
: _name("rom"),
_path("." + slash)
: _name{"rom"},
_path{"." + slash}
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO(const string& p)
: _name(p),
_path(p)
: _name{p},
_path{p}
{
// TODO: use retro_vfs_mkdir_t (file) or RETRO_MEMORY_SAVE_RAM (stream) or libretro save path
if(p == "." + slash + "nvram")

View File

@ -35,7 +35,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SoundLIBRETRO::SoundLIBRETRO(OSystem& osystem, AudioSettings& audioSettings)
: Sound(osystem),
myAudioSettings(audioSettings)
myAudioSettings{audioSettings}
{
Logger::debug("SoundLIBRETRO::SoundLIBRETRO started ...");
Logger::debug("SoundLIBRETRO::SoundLIBRETRO initialized");

View File

@ -31,9 +31,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StellaLIBRETRO::StellaLIBRETRO()
: rom_image{make_unique<uInt8[]>(getROMMax())},
audio_buffer{make_unique<Int16[]>(audio_buffer_max)}
{
audio_buffer = make_unique<Int16[]>(audio_buffer_max);
rom_image = make_unique<uInt8[]>(getROMMax());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -32,10 +32,8 @@ FilesystemNodePOSIX::FilesystemNodePOSIX()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodePOSIX::FilesystemNodePOSIX(const string& path, bool verify)
: _path{path.length() > 0 ? path : "~"} // Default to home directory
{
// Default to home directory
_path = path.length() > 0 ? path : "~";
// Expand '~' to the HOME environment variable
if(_path[0] == '~')
{

View File

@ -58,7 +58,7 @@ class FilesystemNodePOSIX : public AbstractFSNode
* @param verify true if the isValid and isDirectory/isFile flags should
* be verified during the construction.
*/
FilesystemNodePOSIX(const string& path, bool verify = true);
explicit FilesystemNodePOSIX(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

@ -175,10 +175,8 @@ FilesystemNodeWINDOWS::FilesystemNodeWINDOWS()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeWINDOWS::FilesystemNodeWINDOWS(const string& p)
: _path(p.length() > 0 ? p : "~") // Default to home directory
{
// Default to home directory
_path = p.length() > 0 ? p : "~";
// Expand '~' to the users 'home' directory
if(_path[0] == '~')
_path.replace(0, 1, myHomeFinder.getHomePath());