mirror of
https://github.com/ksherlock/mpw.git
synced 2024-06-14 11:29:28 +00:00
convert : -> / for pathnames
(needs to be more complicated but ok for now)
This commit is contained in:
parent
2e1245d9fe
commit
7d10b0da5d
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user