Fix "Create default playlist file; This is an ugly HACK which should be FIXME'd into oblivion some other time" by adding a default playlist file to base.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5263 4a71c877-e1ca-e34f-864e-861f7616d084
master
Dennis Schridde 2008-06-18 18:25:35 +00:00
parent 925c3daced
commit c9b9e98dc9
2 changed files with 9 additions and 16 deletions

View File

@ -0,0 +1,9 @@
[game]
path=music
shuffle=yes
track1.ogg
track2.ogg
[menu]
path=music
menu.ogg

View File

@ -80,22 +80,6 @@ bool PlayList_Read(const char* path)
// Attempt to open the playlist file
fileHandle = PHYSFS_openRead(fileName);
if (fileHandle == NULL)
{
// Create default playlist file
// This is an ugly HACK which should be FIXME'd into oblivion some other time
fileHandle = PHYSFS_openWrite(fileName);
if (fileHandle)
{
const char *gamestr = "[game]\npath=music\nshuffle=yes\ntrack1.ogg\ntrack2.ogg\n\n";
const char *menustr = "[menu]\npath=music\nmenu.ogg\n";
PHYSFS_write(fileHandle, gamestr, strlen(gamestr), 1);
PHYSFS_write(fileHandle, menustr, strlen(menustr), 1);
PHYSFS_close(fileHandle);
}
fileHandle = PHYSFS_openRead(fileName);
}
if (fileHandle == NULL)
{
debug(LOG_NEVER, "sound_LoadTrackFromFile: PHYSFS_openRead(\"%s\") failed with error: %s\n", fileName, PHYSFS_getLastError());
return false;