Fixes #1538: Lua playFile(): current language sound path added to the file name in case of a relative path

This commit is contained in:
Damjan Adamic
2014-08-09 17:37:04 +02:00
parent fd3790519a
commit 07728782c8
3 changed files with 14 additions and 0 deletions
+9
View File
@@ -261,6 +261,15 @@ static int luaGetValue(lua_State *L)
static int luaPlayFile(lua_State *L)
{
const char * filename = luaL_checkstring(L, 1);
if (filename[0] != '/') {
// relative sound file path - use current languague dir for absolute path
char file[AUDIO_FILENAME_MAXLEN+1];
char * str = getAudioPath(file);
strncpy(str, filename, AUDIO_FILENAME_MAXLEN - (str-file));
file[AUDIO_FILENAME_MAXLEN] = 0;
PLAY_FILE(file, 0, 0);
return 0;
}
PLAY_FILE(filename, 0, 0);
return 0;
}