mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r7639) -Fix: FS#487 Changed music/qtmidi.c to not use functions deprecated by Apple (pvz)
This commit is contained in:
parent
f475636186
commit
405f80c0d1
@ -83,16 +83,25 @@ static bool PathToFSSpec(const char *path, FSSpec *spec)
|
|||||||
*/
|
*/
|
||||||
static void SetMIDITypeIfNeeded(const FSSpec *spec)
|
static void SetMIDITypeIfNeeded(const FSSpec *spec)
|
||||||
{
|
{
|
||||||
FInfo info;
|
FSRef ref;
|
||||||
|
FSCatalogInfo catalogInfo;
|
||||||
|
|
||||||
assert(spec);
|
assert(spec);
|
||||||
|
|
||||||
if (noErr != FSpGetFInfo(spec, &info)) return;
|
if (noErr != FSpMakeFSRef(spec, &ref)) return;
|
||||||
|
if (noErr != FSGetCatalogInfo(&ref, kFSCatInfoNodeFlags | kFSCatInfoFinderInfo, &catalogInfo, NULL, NULL, NULL)) return;
|
||||||
/* Set file type to 'Midi' if the file is _not_ an alias. */
|
if (!(catalogInfo.nodeFlags & kFSNodeIsDirectoryMask)) {
|
||||||
if (info.fdType != midiType && !(info.fdFlags & kIsAlias)) {
|
FileInfo * const info = (FileInfo *) catalogInfo.finderInfo;
|
||||||
info.fdType = midiType;
|
if (info->fileType != midiType && !(info->finderFlags & kIsAlias)) {
|
||||||
FSpSetFInfo(spec, &info);
|
OSErr e;
|
||||||
DEBUG(driver, 3, "qtmidi: changed filetype to 'Midi'");
|
info->fileType = midiType;
|
||||||
|
e = FSSetCatalogInfo(&ref, kFSCatInfoFinderInfo, &catalogInfo);
|
||||||
|
if (e == noErr) {
|
||||||
|
DEBUG(driver, 3, "qtmidi: changed filetype to 'Midi'");
|
||||||
|
} else {
|
||||||
|
DEBUG(driver, 0, "qtmidi: changing filetype to 'Midi' failed - error %d", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user