mirror of https://github.com/stella-emu/stella.git
Cleaned up I/O in a few places, using C++ streams where appropriate.
For those reading these logs, I hope to get back to Stella development soon. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3166 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
e9e3670134
commit
a8a30a1746
|
@ -230,7 +230,7 @@ void CheatManager::enable(const string& code, bool enable)
|
||||||
void CheatManager::loadCheatDatabase()
|
void CheatManager::loadCheatDatabase()
|
||||||
{
|
{
|
||||||
const string& cheatfile = myOSystem.cheatFile();
|
const string& cheatfile = myOSystem.cheatFile();
|
||||||
ifstream in(cheatfile.c_str(), ios::in);
|
ifstream in(cheatfile.c_str());
|
||||||
if(!in)
|
if(!in)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -260,7 +260,6 @@ void CheatManager::loadCheatDatabase()
|
||||||
myCheatMap.insert(make_pair(md5, cheat));
|
myCheatMap.insert(make_pair(md5, cheat));
|
||||||
}
|
}
|
||||||
|
|
||||||
in.close();
|
|
||||||
myListIsDirty = false;
|
myListIsDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,14 +270,12 @@ void CheatManager::saveCheatDatabase()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const string& cheatfile = myOSystem.cheatFile();
|
const string& cheatfile = myOSystem.cheatFile();
|
||||||
ofstream out(cheatfile.c_str(), ios::out);
|
ofstream out(cheatfile.c_str());
|
||||||
if(!out)
|
if(!out)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(const auto& iter: myCheatMap)
|
for(const auto& iter: myCheatMap)
|
||||||
out << "\"" << iter.first << "\" " << "\"" << iter.second << "\"" << endl;
|
out << "\"" << iter.first << "\" " << "\"" << iter.second << "\"" << endl;
|
||||||
|
|
||||||
out.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -49,28 +49,27 @@ class Variant
|
||||||
Variant(const string& s) : data(s) { }
|
Variant(const string& s) : data(s) { }
|
||||||
Variant(const char* s) : data(s) { }
|
Variant(const char* s) : data(s) { }
|
||||||
|
|
||||||
Variant(Int32 i) { buf().str(""); buf() << i; data = buf().str(); }
|
Variant(Int32 i) { buf().str(""); buf() << i; data = buf().str(); }
|
||||||
Variant(uInt32 i) { buf().str(""); buf() << i; data = buf().str(); }
|
Variant(uInt32 i) { buf().str(""); buf() << i; data = buf().str(); }
|
||||||
Variant(float f) { buf().str(""); buf() << f; data = buf().str(); }
|
Variant(float f) { buf().str(""); buf() << f; data = buf().str(); }
|
||||||
Variant(double d) { buf().str(""); buf() << d; data = buf().str(); }
|
Variant(double d) { buf().str(""); buf() << d; data = buf().str(); }
|
||||||
Variant(bool b) { buf().str(""); buf() << b; data = buf().str(); }
|
Variant(bool b) { buf().str(""); buf() << b; data = buf().str(); }
|
||||||
Variant(const GUI::Size& s) { buf().str(""); buf() << s; data = buf().str(); }
|
Variant(const GUI::Size& s) { buf().str(""); buf() << s; data = buf().str(); }
|
||||||
|
|
||||||
// Conversion methods
|
// Conversion methods
|
||||||
const string& toString() const { return data; }
|
const string& toString() const { return data; }
|
||||||
const char* toCString() const { return data.c_str(); }
|
const char* toCString() const { return data.c_str(); }
|
||||||
const Int32 toInt() const { return atoi(data.c_str()); }
|
const Int32 toInt() const { return atoi(data.c_str()); }
|
||||||
const float toFloat() const { return atof(data.c_str()); }
|
const float toFloat() const { return atof(data.c_str()); }
|
||||||
const bool toBool() const { return data == "1" || data == "true"; }
|
const bool toBool() const { return data == "1" || data == "true"; }
|
||||||
const GUI::Size toSize() const { return GUI::Size(data); }
|
const GUI::Size toSize() const { return GUI::Size(data); }
|
||||||
|
|
||||||
// Comparison
|
// Comparison
|
||||||
bool operator==(const Variant& v) const { return data == v.data; };
|
bool operator==(const Variant& v) const { return data == v.data; };
|
||||||
bool operator!=(const Variant& v) const { return data != v.data; };
|
bool operator!=(const Variant& v) const { return data != v.data; };
|
||||||
|
|
||||||
friend ostream& operator<<(ostream& os, const Variant& v) {
|
friend ostream& operator<<(ostream& os, const Variant& v) {
|
||||||
os << v.data;
|
return os << v.data;
|
||||||
return os;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -729,7 +729,6 @@ string CartDebug::loadListFile()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in.close();
|
|
||||||
myDebugger.rom().invalidate();
|
myDebugger.rom().invalidate();
|
||||||
|
|
||||||
return "loaded " + node.getShortPath() + " OK";
|
return "loaded " + node.getShortPath() + " OK";
|
||||||
|
@ -785,7 +784,6 @@ string CartDebug::loadSymbolFile()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in.close();
|
|
||||||
myDebugger.rom().invalidate();
|
myDebugger.rom().invalidate();
|
||||||
|
|
||||||
return "loaded " + node.getShortPath() + " OK";
|
return "loaded " + node.getShortPath() + " OK";
|
||||||
|
@ -895,7 +893,6 @@ string CartDebug::loadConfigFile()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in.close();
|
|
||||||
myDebugger.rom().invalidate();
|
myDebugger.rom().invalidate();
|
||||||
|
|
||||||
return "loaded " + node.getShortPath() + " OK";
|
return "loaded " + node.getShortPath() + " OK";
|
||||||
|
@ -940,7 +937,6 @@ string CartDebug::saveConfigFile()
|
||||||
out << "[" << b << "]" << endl;
|
out << "[" << b << "]" << endl;
|
||||||
getBankDirectives(out, myBankInfo[b]);
|
getBankDirectives(out, myBankInfo[b]);
|
||||||
}
|
}
|
||||||
out.close();
|
|
||||||
|
|
||||||
return "saved " + node.getShortPath() + " OK";
|
return "saved " + node.getShortPath() + " OK";
|
||||||
}
|
}
|
||||||
|
@ -1148,8 +1144,6 @@ string CartDebug::saveDisassembly()
|
||||||
// And finally, output the disassembly
|
// And finally, output the disassembly
|
||||||
out << buf.str();
|
out << buf.str();
|
||||||
|
|
||||||
out.close();
|
|
||||||
|
|
||||||
return "saved " + node.getShortPath() + " OK";
|
return "saved " + node.getShortPath() + " OK";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1160,7 +1154,7 @@ string CartDebug::saveRom()
|
||||||
myConsole.properties().get(Cartridge_Name) + ".a26";
|
myConsole.properties().get(Cartridge_Name) + ".a26";
|
||||||
|
|
||||||
FilesystemNode node(path);
|
FilesystemNode node(path);
|
||||||
ofstream out(node.getPath().c_str(), ios::out | ios::binary);
|
ofstream out(node.getPath().c_str(), ios::binary);
|
||||||
if(out.is_open() && myConsole.cartridge().save(out))
|
if(out.is_open() && myConsole.cartridge().save(out))
|
||||||
return "saved ROM as " + node.getShortPath();
|
return "saved ROM as " + node.getShortPath();
|
||||||
else
|
else
|
||||||
|
|
|
@ -619,9 +619,7 @@ bool DebuggerParser::saveScriptFile(string file)
|
||||||
for(const auto& cond: conds)
|
for(const auto& cond: conds)
|
||||||
out << "breakif {" << cond << "}" << endl;
|
out << "breakif {" << cond << "}" << endl;
|
||||||
|
|
||||||
bool ok = out.good();
|
return out.good();
|
||||||
out.close();
|
|
||||||
return ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -854,7 +854,8 @@ bool PromptWidget::saveBuffer(string& filename)
|
||||||
if(!out.is_open())
|
if(!out.is_open())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for(int start=0; start<_promptStartPos; start+=_lineWidth) {
|
for(int start=0; start<_promptStartPos; start+=_lineWidth)
|
||||||
|
{
|
||||||
int end = start+_lineWidth-1;
|
int end = start+_lineWidth-1;
|
||||||
|
|
||||||
// look for first non-space, printing char from end of line
|
// look for first non-space, printing char from end of line
|
||||||
|
@ -863,14 +864,13 @@ bool PromptWidget::saveBuffer(string& filename)
|
||||||
|
|
||||||
// spit out the line minus its trailing junk.
|
// spit out the line minus its trailing junk.
|
||||||
// Strip off any color/inverse bits
|
// Strip off any color/inverse bits
|
||||||
for(int j=start; j<=end; j++)
|
for(int j = start; j <= end; ++j)
|
||||||
out << char(_buffer[j] & 0xff);
|
out << char(_buffer[j] & 0xff);
|
||||||
|
|
||||||
// add a \n
|
// add a \n
|
||||||
out << endl;
|
out << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
out.close();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -757,7 +757,6 @@ void Console::loadUserPalette()
|
||||||
in.seekg(0, ios::beg);
|
in.seekg(0, ios::beg);
|
||||||
if(length < 128 * 3 * 2 + 8 * 3)
|
if(length < 128 * 3 * 2 + 8 * 3)
|
||||||
{
|
{
|
||||||
in.close();
|
|
||||||
cerr << "ERROR: invalid palette file " << palette << endl;
|
cerr << "ERROR: invalid palette file " << palette << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -794,7 +793,6 @@ void Console::loadUserPalette()
|
||||||
*ptr++ = *s++;
|
*ptr++ = *s++;
|
||||||
}
|
}
|
||||||
|
|
||||||
in.close();
|
|
||||||
myUserPaletteDefined = true;
|
myUserPaletteDefined = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -518,11 +518,10 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state)
|
||||||
{
|
{
|
||||||
string filename = myOSystem.baseDir() +
|
string filename = myOSystem.baseDir() +
|
||||||
myOSystem.console().properties().get(Cartridge_Name) + ".pro";
|
myOSystem.console().properties().get(Cartridge_Name) + ".pro";
|
||||||
ofstream out(filename.c_str(), ios::out);
|
ofstream out(filename.c_str());
|
||||||
if(out)
|
if(out)
|
||||||
{
|
{
|
||||||
myOSystem.console().properties().save(out);
|
out << myOSystem.console().properties();
|
||||||
out.close();
|
|
||||||
myOSystem.frameBuffer().showMessage("Properties saved");
|
myOSystem.frameBuffer().showMessage("Properties saved");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -85,7 +85,6 @@ MT24LC256::MT24LC256(const string& filename, const System& system)
|
||||||
in.read((char*)myData, 32768);
|
in.read((char*)myData, 32768);
|
||||||
myDataFileExists = true;
|
myDataFileExists = true;
|
||||||
}
|
}
|
||||||
in.close();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
myDataFileExists = false;
|
myDataFileExists = false;
|
||||||
|
@ -100,13 +99,9 @@ MT24LC256::~MT24LC256()
|
||||||
// Save EEPROM data to external file only when necessary
|
// Save EEPROM data to external file only when necessary
|
||||||
if(!myDataFileExists || myDataChanged)
|
if(!myDataFileExists || myDataChanged)
|
||||||
{
|
{
|
||||||
ofstream out;
|
ofstream out(myDataFile.c_str(), ios_base::binary);
|
||||||
out.open(myDataFile.c_str(), ios_base::binary);
|
|
||||||
if(out.is_open())
|
if(out.is_open())
|
||||||
{
|
|
||||||
out.write((char*)myData, 32768);
|
out.write((char*)myData, 32768);
|
||||||
out.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,19 +36,10 @@ Properties::Properties(const Properties& properties)
|
||||||
copy(properties);
|
copy(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
const string& Properties::get(PropertyType key) const
|
|
||||||
{
|
|
||||||
if(key >= 0 && key < LastPropType)
|
|
||||||
return myProperties[key];
|
|
||||||
else
|
|
||||||
return EmptyString;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Properties::set(PropertyType key, const string& value)
|
void Properties::set(PropertyType key, const string& value)
|
||||||
{
|
{
|
||||||
if(key >= 0 && key < LastPropType)
|
if(key != LastPropType)
|
||||||
{
|
{
|
||||||
myProperties[key] = value;
|
myProperties[key] = value;
|
||||||
|
|
||||||
|
@ -91,52 +82,54 @@ void Properties::set(PropertyType key, const string& value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Properties::load(istream& in)
|
istream& operator>>(istream& is, Properties& p)
|
||||||
{
|
{
|
||||||
setDefaults();
|
p.setDefaults();
|
||||||
|
|
||||||
// Loop reading properties
|
// Loop reading properties
|
||||||
string key, value;
|
string key, value;
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
// Get the key associated with this property
|
// Get the key associated with this property
|
||||||
key = readQuotedString(in);
|
key = p.readQuotedString(is);
|
||||||
|
|
||||||
// Make sure the stream is still okay
|
// Make sure the stream is still okay
|
||||||
if(!in)
|
if(!is)
|
||||||
return;
|
return is;
|
||||||
|
|
||||||
// A null key signifies the end of the property list
|
// A null key signifies the end of the property list
|
||||||
if(key == "")
|
if(key == "")
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Get the value associated with this property
|
// Get the value associated with this property
|
||||||
value = readQuotedString(in);
|
value = p.readQuotedString(is);
|
||||||
|
|
||||||
// Make sure the stream is still okay
|
// Make sure the stream is still okay
|
||||||
if(!in)
|
if(!is)
|
||||||
return;
|
return is;
|
||||||
|
|
||||||
// Set the property
|
// Set the property
|
||||||
PropertyType type = getPropertyType(key);
|
PropertyType type = Properties::getPropertyType(key);
|
||||||
set(type, value);
|
p.set(type, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Properties::save(ostream& out) const
|
ostream& operator<<(ostream& os, const Properties& p)
|
||||||
{
|
{
|
||||||
// Write out each of the key and value pairs
|
// Write out each of the key and value pairs
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
for(int i = 0; i < LastPropType; ++i)
|
for(int i = 0; i < LastPropType; ++i)
|
||||||
{
|
{
|
||||||
// Try to save some space by only saving the items that differ from default
|
// Try to save some space by only saving the items that differ from default
|
||||||
if(myProperties[i] != ourDefaultProperties[i])
|
if(p.myProperties[i] != Properties::ourDefaultProperties[i])
|
||||||
{
|
{
|
||||||
writeQuotedString(out, ourPropertyNames[i]);
|
p.writeQuotedString(os, Properties::ourPropertyNames[i]);
|
||||||
out.put(' ');
|
os.put(' ');
|
||||||
writeQuotedString(out, myProperties[i]);
|
p.writeQuotedString(os, p.myProperties[i]);
|
||||||
out.put('\n');
|
os.put('\n');
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,23 +137,22 @@ void Properties::save(ostream& out) const
|
||||||
if(changed)
|
if(changed)
|
||||||
{
|
{
|
||||||
// Put a trailing null string so we know when to stop reading
|
// Put a trailing null string so we know when to stop reading
|
||||||
writeQuotedString(out, "");
|
p.writeQuotedString(os, "");
|
||||||
out.put('\n');
|
os.put('\n');
|
||||||
out.put('\n');
|
os.put('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string Properties::readQuotedString(istream& in)
|
string Properties::readQuotedString(istream& in)
|
||||||
{
|
{
|
||||||
char c;
|
|
||||||
|
|
||||||
// Read characters until we see a quote
|
// Read characters until we see a quote
|
||||||
|
char c;
|
||||||
while(in.get(c))
|
while(in.get(c))
|
||||||
{
|
|
||||||
if(c == '"')
|
if(c == '"')
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
// Read characters until we see the close quote
|
// Read characters until we see the close quote
|
||||||
string s;
|
string s;
|
||||||
|
|
|
@ -84,7 +84,9 @@ class Properties
|
||||||
@param key The key of the property to lookup
|
@param key The key of the property to lookup
|
||||||
@return The value of the property
|
@return The value of the property
|
||||||
*/
|
*/
|
||||||
const string& get(PropertyType key) const;
|
const string& get(PropertyType key) const {
|
||||||
|
return key != LastPropType ? myProperties[key] : EmptyString;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the value associated with key to the given value.
|
Set the value associated with key to the given value.
|
||||||
|
@ -99,14 +101,14 @@ class Properties
|
||||||
|
|
||||||
@param in The input stream to use
|
@param in The input stream to use
|
||||||
*/
|
*/
|
||||||
void load(istream& in);
|
friend istream& operator>>(istream& is, Properties& p);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Save properties to the specified output stream
|
Save properties to the specified output stream
|
||||||
|
|
||||||
@param out The output stream to use
|
@param out The output stream to use
|
||||||
*/
|
*/
|
||||||
void save(ostream& out) const;
|
friend ostream& operator<<(ostream& os, const Properties& p);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Print the attributes of this properties object
|
Print the attributes of this properties object
|
||||||
|
|
|
@ -37,7 +37,7 @@ PropertiesSet::PropertiesSet(const string& propsfile)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void PropertiesSet::load(const string& filename)
|
void PropertiesSet::load(const string& filename)
|
||||||
{
|
{
|
||||||
ifstream in(filename.c_str(), ios::in);
|
ifstream in(filename.c_str());
|
||||||
|
|
||||||
// Loop reading properties
|
// Loop reading properties
|
||||||
for(;;)
|
for(;;)
|
||||||
|
@ -48,26 +48,24 @@ void PropertiesSet::load(const string& filename)
|
||||||
|
|
||||||
// Get the property list associated with this profile
|
// Get the property list associated with this profile
|
||||||
Properties prop;
|
Properties prop;
|
||||||
prop.load(in);
|
in >> prop;
|
||||||
|
|
||||||
// If the stream is still good then insert the properties
|
// If the stream is still good then insert the properties
|
||||||
if(in)
|
if(in)
|
||||||
insert(prop);
|
insert(prop);
|
||||||
}
|
}
|
||||||
if(in)
|
|
||||||
in.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool PropertiesSet::save(const string& filename) const
|
bool PropertiesSet::save(const string& filename) const
|
||||||
{
|
{
|
||||||
ofstream out(filename.c_str(), ios::out);
|
ofstream out(filename.c_str());
|
||||||
if(!out)
|
if(!out)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Only save those entries in the external list
|
// Only save those entries in the external list
|
||||||
for(const auto& i: myExternalProps)
|
for(const auto& i: myExternalProps)
|
||||||
i.second.save(out);
|
out << i.second;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -196,10 +194,8 @@ void PropertiesSet::print() const
|
||||||
// The easiest way to merge the lists is to create another temporary one
|
// The easiest way to merge the lists is to create another temporary one
|
||||||
// This isn't fast, but I suspect this method isn't used too often (or at all)
|
// This isn't fast, but I suspect this method isn't used too often (or at all)
|
||||||
|
|
||||||
PropsList list;
|
|
||||||
|
|
||||||
// First insert all external props
|
// First insert all external props
|
||||||
list = myExternalProps;
|
PropsList list = myExternalProps;
|
||||||
|
|
||||||
// Now insert all the built-in ones
|
// Now insert all the built-in ones
|
||||||
// Note that if we try to insert a duplicate, the insertion will fail
|
// Note that if we try to insert a duplicate, the insertion will fail
|
||||||
|
|
|
@ -200,8 +200,6 @@ void Settings::loadConfig()
|
||||||
if(int idx = getInternalPos(key) != -1)
|
if(int idx = getInternalPos(key) != -1)
|
||||||
setInternal(key, value, idx, true);
|
setInternal(key, value, idx, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
in.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -263,7 +261,7 @@ string Settings::loadCommandLine(int argc, char** argv)
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return EmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -539,8 +537,6 @@ void Settings::saveConfig()
|
||||||
// Write out each of the key and value pairs
|
// Write out each of the key and value pairs
|
||||||
for(const auto& s: myInternalSettings)
|
for(const auto& s: myInternalSettings)
|
||||||
out << s.key << " = " << s.value << endl;
|
out << s.key << " = " << s.value << endl;
|
||||||
|
|
||||||
out.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -119,12 +119,9 @@ void LoggerDialog::saveLogFile()
|
||||||
path << "~" << BSPF_PATH_SEPARATOR << "stella.log";
|
path << "~" << BSPF_PATH_SEPARATOR << "stella.log";
|
||||||
FilesystemNode node(path.str());
|
FilesystemNode node(path.str());
|
||||||
|
|
||||||
ofstream out(node.getPath().c_str(), ios::out);
|
ofstream out(node.getPath().c_str());
|
||||||
if(out.is_open())
|
if(out.is_open())
|
||||||
{
|
|
||||||
out << instance().logMessages();
|
out << instance().logMessages();
|
||||||
out.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -52,7 +52,6 @@ OSystemWINDOWS::OSystemWINDOWS()
|
||||||
if(in && in.is_open())
|
if(in && in.is_open())
|
||||||
{
|
{
|
||||||
getline(in, basedir);
|
getline(in, basedir);
|
||||||
in.close();
|
|
||||||
|
|
||||||
// trim leading and trailing spaces
|
// trim leading and trailing spaces
|
||||||
size_t spos = basedir.find_first_not_of(" \t");
|
size_t spos = basedir.find_first_not_of(" \t");
|
||||||
|
|
Loading…
Reference in New Issue