mirror of
https://github.com/ksherlock/mpw.git
synced 2024-11-22 00:32:44 +00:00
open - set binary flag based on extension
This commit is contained in:
parent
61ea17ff4a
commit
e88f379eb1
14
mpw/mpw.cpp
14
mpw/mpw.cpp
@ -118,6 +118,8 @@ namespace {
|
||||
|
||||
fprintf(stderr, " open(%s, %04x)\n", sname.c_str(), f.flags);
|
||||
|
||||
// TODO -- can you create a resource file like this?
|
||||
|
||||
if (f.flags & kO_RSRC)
|
||||
sname.append(_PATH_RSRCFORKSPEC);
|
||||
|
||||
@ -143,8 +145,20 @@ namespace {
|
||||
FDTable.resize(fd + 1);
|
||||
|
||||
FDTable[fd] = 1;
|
||||
|
||||
|
||||
// adjust the binary flags...
|
||||
// most apps are good about this but dumpobj doesn't set O_BINARY (but should)
|
||||
// and MPW Assembler sets O_BINARY (but shouldn't)
|
||||
|
||||
if (OS::IsTextFile(sname)) f.flags &= ~kO_BINARY;
|
||||
if (OS::IsBinaryFile(sname)) f.flags |= kO_BINARY;
|
||||
|
||||
if (f.flags & kO_RSRC) f.flags |= kO_BINARY;
|
||||
|
||||
}
|
||||
|
||||
memoryWriteWord(f.flags, parm + 0);
|
||||
memoryWriteWord(f.error, parm + 2);
|
||||
memoryWriteLong(f.cookie, parm + 8);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user