mirror of
https://github.com/ksherlock/mpw.git
synced 2025-01-03 04:30:32 +00:00
SetFinderInfo for filetype/creator
This commit is contained in:
parent
9d46424968
commit
b7aa23f163
@ -278,24 +278,7 @@ namespace OS {
|
||||
::close(fd);
|
||||
}
|
||||
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
d0 = OS::Internal::SetFinderInfo(sname, fileType, creator);
|
||||
|
||||
return d0;
|
||||
}
|
||||
|
@ -220,6 +220,24 @@ namespace OS { namespace Internal {
|
||||
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)
|
||||
{
|
||||
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 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);
|
||||
|
||||
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.
|
||||
if (rv.error() == 0)
|
||||
{
|
||||
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);
|
||||
// this is a new file, set the full finder info.
|
||||
OS::Internal::SetFinderInfo(sname, buffer, true);
|
||||
OS::Internal::SetFinderInfo(sname, fileType, creator);
|
||||
}
|
||||
|
||||
return SetResError(rv.error() == errFSForkExists ? 0 : rv.error());
|
||||
|
Loading…
Reference in New Issue
Block a user