convert : -> / for pathnames

(needs to be more complicated but ok for now)
This commit is contained in:
Kelvin Sherlock 2013-02-17 01:18:00 -05:00
parent 2e1245d9fe
commit 7d10b0da5d
4 changed files with 14 additions and 9 deletions

View File

@ -63,7 +63,7 @@ namespace MPW
if (f.flags & kO_EXCL) nativeFlags |= O_EXCL;
sname = ToolBox::ReadCString(name);
sname = ToolBox::ReadCString(name, true);
Log(" open(%s, %04x)\n", sname.c_str(), f.flags);

View File

@ -165,7 +165,7 @@ namespace OS
//uint16_t ioVRefNum = memoryReadWord(parm + 22);
//uint8_t ioFVersNum = memoryReadByte(parm + 26);
std::string sname = ToolBox::ReadPString(namePtr);
std::string sname = ToolBox::ReadPString(namePtr, true);
if (!sname.length())
{
@ -205,7 +205,7 @@ namespace OS
//uint16_t ioVRefNum = memoryReadWord(parm + 22);
//uint8_t ioFVersNum = memoryReadByte(parm + 26);
std::string sname = ToolBox::ReadPString(namePtr);
std::string sname = ToolBox::ReadPString(namePtr, true);
if (!sname.length())
{
@ -306,7 +306,7 @@ namespace OS
return bdNamErr;
}
sname = ToolBox::ReadPString(ioNamePtr);
sname = ToolBox::ReadPString(ioNamePtr, true);
Log(" GetFileInfo(%s)\n", sname.c_str());
@ -427,7 +427,7 @@ namespace OS
return bdNamErr;
}
sname = ToolBox::ReadPString(ioNamePtr);
sname = ToolBox::ReadPString(ioNamePtr, true);
Log(" SetFileInfo(%s)\n", sname.c_str());
// check if the file actually exists

View File

@ -172,7 +172,7 @@ namespace ToolBox {
cpuSetFlagsNZ00NewW(d0);
}
std::string ReadCString(uint32_t address)
std::string ReadCString(uint32_t address, bool fname)
{
std::string tmp;
@ -181,10 +181,12 @@ namespace ToolBox {
tmp.assign((char *)memoryPointer(address));
}
if (fname) std::replace(tmp.begin(), tmp.end(), ':', '/');
return tmp;
}
std::string ReadPString(uint32_t address)
std::string ReadPString(uint32_t address, bool fname)
{
std::string tmp;
@ -193,6 +195,9 @@ namespace ToolBox {
unsigned length = memoryReadByte(address);
tmp.assign((char *)memoryPointer(address + 1), length);
if (fname) std::replace(tmp.begin(), tmp.end(), ':', '/');
}
return tmp;

View File

@ -20,8 +20,8 @@ namespace ToolBox
void dispatch(uint16_t trap);
std::string ReadCString(uint32_t address);
std::string ReadPString(uint32_t address);
std::string ReadCString(uint32_t address, bool fname = false);
std::string ReadPString(uint32_t address, bool fname = false);
bool WritePString(uint32_t address, const std::string &s);
}