summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-12-30 11:28:26 +0000
committerbjarni <bjarni@openttd.org>2006-12-30 11:28:26 +0000
commit405f80c0d12557152a24e579c8ca26e114d1a8b0 (patch)
tree401b84f8f9e3a87694fe170dcf59aee256d27707
parentf475636186a7c4d3aac9ae8998cdd3cd9f3983f9 (diff)
downloadopenttd-405f80c0d12557152a24e579c8ca26e114d1a8b0.tar.xz
(svn r7639) -Fix: FS#487 Changed music/qtmidi.c to not use functions deprecated by Apple (pvz)
-rw-r--r--music/qtmidi.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/music/qtmidi.c b/music/qtmidi.c
index 69fc6f618..6f0a215d0 100644
--- a/music/qtmidi.c
+++ b/music/qtmidi.c
@@ -83,16 +83,25 @@ static bool PathToFSSpec(const char *path, FSSpec *spec)
*/
static void SetMIDITypeIfNeeded(const FSSpec *spec)
{
- FInfo info;
- assert(spec);
+ FSRef ref;
+ FSCatalogInfo catalogInfo;
- if (noErr != FSpGetFInfo(spec, &info)) return;
+ assert(spec);
- /* Set file type to 'Midi' if the file is _not_ an alias. */
- if (info.fdType != midiType && !(info.fdFlags & kIsAlias)) {
- info.fdType = midiType;
- FSpSetFInfo(spec, &info);
- DEBUG(driver, 3, "qtmidi: changed filetype to 'Midi'");
+ if (noErr != FSpMakeFSRef(spec, &ref)) return;
+ if (noErr != FSGetCatalogInfo(&ref, kFSCatInfoNodeFlags | kFSCatInfoFinderInfo, &catalogInfo, NULL, NULL, NULL)) return;
+ if (!(catalogInfo.nodeFlags & kFSNodeIsDirectoryMask)) {
+ FileInfo * const info = (FileInfo *) catalogInfo.finderInfo;
+ if (info->fileType != midiType && !(info->finderFlags & kIsAlias)) {
+ OSErr e;
+ 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);
+ }
+ }
}
}