mirror of
https://github.com/ksherlock/mpw.git
synced 2025-01-08 22:30:25 +00:00
SetFinderInfo for filetype/creator
This commit is contained in:
parent
9d46424968
commit
b7aa23f163
@ -278,24 +278,7 @@ namespace OS {
|
|||||||
::close(fd);
|
::close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
d0 = OS::Internal::SetFinderInfo(sname, fileType, creator);
|
||||||
char buffer[32];
|
|
||||||
std::memset(buffer, 0, sizeof(buffer));
|
|
||||||
buffer[0] = fileType >> 24;
|
|
||||||
buffer[1] = fileType >> 16;
|
|
||||||
buffer[2] = fileType >> 8;
|
|
||||||
buffer[3] = fileType >> 0;
|
|
||||||
|
|
||||||
buffer[4] = creator >> 24;
|
|
||||||
buffer[5] = creator >> 16;
|
|
||||||
buffer[6] = creator >> 8;
|
|
||||||
buffer[7] = creator >> 0;
|
|
||||||
|
|
||||||
std::memcpy(buffer+4, &creator, 4);
|
|
||||||
// since this is a new file, set the entire finder info.
|
|
||||||
d0 = OS::Internal::SetFinderInfo(sname, buffer, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return d0;
|
return d0;
|
||||||
}
|
}
|
||||||
|
@ -220,6 +220,24 @@ namespace OS { namespace Internal {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t SetFinderInfo(const std::string &pathName, uint32_t fileType, uint32_t creator)
|
||||||
|
{
|
||||||
|
uint8_t buffer[32];
|
||||||
|
std::memset(buffer, 0, sizeof(buffer));
|
||||||
|
|
||||||
|
buffer[0] = fileType >> 24;
|
||||||
|
buffer[1] = fileType >> 16;
|
||||||
|
buffer[2] = fileType >> 8;
|
||||||
|
buffer[3] = fileType >> 0;
|
||||||
|
|
||||||
|
buffer[4] = creator >> 24;
|
||||||
|
buffer[5] = creator >> 16;
|
||||||
|
buffer[6] = creator >> 8;
|
||||||
|
buffer[7] = creator >> 0;
|
||||||
|
|
||||||
|
return SetFinderInfo(pathName, buffer, true);
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t SetFinderInfo(const std::string &pathName, void *info, bool extended)
|
uint16_t SetFinderInfo(const std::string &pathName, void *info, bool extended)
|
||||||
{
|
{
|
||||||
uint8_t buffer[32];
|
uint8_t buffer[32];
|
||||||
|
@ -9,6 +9,8 @@ namespace OS { namespace Internal {
|
|||||||
uint16_t GetFinderInfo(const std::string &pathname, void *info, bool extended);
|
uint16_t GetFinderInfo(const std::string &pathname, void *info, bool extended);
|
||||||
uint16_t SetFinderInfo(const std::string &pathname, void *info, bool extended);
|
uint16_t SetFinderInfo(const std::string &pathname, void *info, bool extended);
|
||||||
|
|
||||||
|
uint16_t SetFinderInfo(const std::string &pathName, uint32_t fileType, uint32_t creator);
|
||||||
|
|
||||||
uint16_t GetFileType(const std::string &pathname, uint16_t *fileType, uint32_t *auxType);
|
uint16_t GetFileType(const std::string &pathname, uint16_t *fileType, uint32_t *auxType);
|
||||||
|
|
||||||
int32_t mac_seek(uint16_t refNum, uint16_t mode, int32_t offset);
|
int32_t mac_seek(uint16_t refNum, uint16_t mode, int32_t offset);
|
||||||
|
@ -537,21 +537,7 @@ namespace RM
|
|||||||
// therefore, if no error, set the ftype/ctype.
|
// therefore, if no error, set the ftype/ctype.
|
||||||
if (rv.error() == 0)
|
if (rv.error() == 0)
|
||||||
{
|
{
|
||||||
char buffer[32];
|
OS::Internal::SetFinderInfo(sname, fileType, creator);
|
||||||
std::memset(buffer, 0, sizeof(buffer));
|
|
||||||
buffer[0] = fileType >> 24;
|
|
||||||
buffer[1] = fileType >> 16;
|
|
||||||
buffer[2] = fileType >> 8;
|
|
||||||
buffer[3] = fileType >> 0;
|
|
||||||
|
|
||||||
buffer[4] = creator >> 24;
|
|
||||||
buffer[5] = creator >> 16;
|
|
||||||
buffer[6] = creator >> 8;
|
|
||||||
buffer[7] = creator >> 0;
|
|
||||||
|
|
||||||
std::memcpy(buffer+4, &creator, 4);
|
|
||||||
// this is a new file, set the full finder info.
|
|
||||||
OS::Internal::SetFinderInfo(sname, buffer, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return SetResError(rv.error() == errFSForkExists ? 0 : rv.error());
|
return SetResError(rv.error() == errFSForkExists ? 0 : rv.error());
|
||||||
|
Loading…
Reference in New Issue
Block a user