summaryrefslogtreecommitdiff
path: root/src/music
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2008-03-15 21:20:40 +0000
committerglx <glx@openttd.org>2008-03-15 21:20:40 +0000
commit013d7db19f976e1ef9002ceba53f5fa87fd915a0 (patch)
treee2491cc8136d425ba25a49db8b53aa6d63784ca0 /src/music
parent1abd2bd700872098e10fedd65bde994d517789d6 (diff)
downloadopenttd-013d7db19f976e1ef9002ceba53f5fa87fd915a0.tar.xz
(svn r12373) -Fix [FS#1849]: win32 music driver fails if path is too long (128 chars is too much for mci it seems), so retry using the short path name (8.3 style) if available
Diffstat (limited to 'src/music')
-rw-r--r--src/music/win32_m.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/music/win32_m.cpp b/src/music/win32_m.cpp
index 8ec6756c4..8ad964977 100644
--- a/src/music/win32_m.cpp
+++ b/src/music/win32_m.cpp
@@ -61,7 +61,12 @@ static bool MidiIntPlaySong(const char *filename)
{
MidiSendCommand(_T("close all"));
- if (MidiSendCommand(_T("open \"%s\" type sequencer alias song"), OTTD2FS(filename)) != 0) return false;
+ if (MidiSendCommand(_T("open \"%s\" type sequencer alias song"), OTTD2FS(filename)) != 0) {
+ /* Let's try the "short name" */
+ TCHAR buf[MAX_PATH];
+ if (GetShortPathName(OTTD2FS(filename), buf, MAX_PATH) == 0) return false;
+ if (MidiSendCommand(_T("open \"%s\" type sequencer alias song"), buf) != 0) return false;
+ }
return MidiSendCommand(_T("play song from 0")) == 0;
}