Install path bug fixes.

This commit is contained in:
Steve 2015-12-03 08:43:26 +00:00
parent 65b62091d1
commit 9825e39f4f
4 changed files with 8 additions and 6 deletions

View File

@ -6,7 +6,7 @@ VERSION = 0.4
REVISION = $(shell date +"%y%m%d")
DEBUG = 0
CXXFLAGS += `sdl2-config --cflags` -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDEBUG=$(DEBUG)
CXXFLAGS += `sdl2-config --cflags` -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDEBUG=$(DEBUG) -DDATA_DIR=\"$(DATA_DIR)\"
CXXFLAGS += -Wall -ansi -pedantic -Werror -Wstrict-prototypes
CXXFLAGS += -g -lefence

View File

@ -66,6 +66,7 @@ int writeFile(char *filename, char *data)
char *getSaveFilePath(char *filename)
{
static char path[MAX_FILENAME_LENGTH];
memset(path, '\0', MAX_FILENAME_LENGTH);
sprintf(path, "%s/%s", app.saveDir, filename);
@ -77,13 +78,14 @@ char *getSaveFilePath(char *filename)
char *getFileLocation(char *filename)
{
static char path[MAX_FILENAME_LENGTH];
memset(path, '\0', MAX_FILENAME_LENGTH);
if (fileExists(filename))
{
return filename;
}
sprintf(path, "%s/%s\n", DATA_DIR, filename);
sprintf(path, DATA_DIR"/%s", filename);
return path;
}

View File

@ -46,7 +46,7 @@ void playMusic(char *filename)
music = NULL;
}
music = Mix_LoadMUS(filename);
music = Mix_LoadMUS(getFileLocation(filename));
Mix_PlayMusic(music, -1);
}

View File

@ -45,7 +45,7 @@ void initWidgets(void)
optionsLeft = getTexture("gfx/widgets/optionsLeft.png");
optionsRight = getTexture("gfx/widgets/optionsRight.png");
loadWidgets(getFileLocation("data/widgets/list.json"));
loadWidgets("data/widgets/list.json");
drawingWidgets = 0;
}
@ -236,7 +236,7 @@ static void loadWidgets(char *filename)
for (node = root->child ; node != NULL ; node = node->next)
{
loadWidgetSet(getFileLocation(node->valuestring));
loadWidgetSet(node->valuestring);
}
cJSON_Delete(root);