Commit f45b93e3 authored by Matthew Trey's avatar Matthew Trey

removed remaining hard-coded word list paths in wordlist editor

git-svn-id: svn://svn.debian.org/svn/tux4kids/tuxtype/trunk@1653 47d30e19-490b-0410-9d18-e851f4e465b3
parent 5fa6881a
......@@ -19,4 +19,8 @@ Apart from GSoC, both programs need ongoing code cleanup, especially tuxtype. A
-check that SVN is free of generated files. create release-script,
- change location of custom word lists in Windows build to user's application data folder
- tweaking of display for word list editor with better user feedback
- display xml lesson files using title rather than file name
- have tuxtype automatically go into either the OS locale, or perhaps the selected locale from the previous session, rather than always English.
......@@ -501,14 +501,28 @@ void EditWordList(char* words_file)
int i, len, j = 0;
int listening_for_new_word = 0;
char fn[FNLEN];
char wordsDir[FNLEN];
char words_in_list[MAX_NUM_WORDS][MAX_WORD_SIZE + 1];
wchar_t temp[MAX_WORD_SIZE + 1];
// get appropriate directory
sprintf(wordsDir, "%s/words", settings.user_settings_path);
if (CheckFile(wordsDir))
{
DEBUGCODE { fprintf(stderr, "User specific wordlist path found: %s\n", wordsDir); }
}
else
{
DEBUGCODE { fprintf(stderr , "Editor: checking directory: %s/words", settings.var_data_path); }
sprintf(wordsDir , "%s/words" , settings.var_data_path);
}
//We should be able to use GenerateWordList() in place of this next block:
//NOTE: Works originally, but upon returning to editorlist, the word selected
// is not there, since all words in the wordlist are deleted
sprintf(fn , "%s/words/%s", settings.var_data_path, words_file);
sprintf(fn , "%s/%s", wordsDir, words_file);
fp = fopen(fn,"r");
number_of_words = 0;
......@@ -950,6 +964,7 @@ int CreateNewWordList(void)
SDL_Rect Directions_rect;
FILE* fp = NULL;
char fn[FNLEN];
char wordsDir[FNLEN];
char wordlist[MAX_WORD_SIZE + 1];
wchar_t temp[MAX_WORD_SIZE + 1];
wordlist[0] = 0;
......@@ -1143,7 +1158,7 @@ int CreateNewWordList(void)
/* Creating file, if possible */
if (save == 1)
{
sprintf(fn, "%s/words/%s.txt", settings.var_data_path, wordlist);
sprintf(fn, "%s/%s.txt", wordsDir, wordlist);
DEBUGCODE{ fprintf(stderr, "File to be saved: %s\n", fn); }
fp = fopen(fn, "w");
......@@ -1276,9 +1291,21 @@ int ChooseRemoveList(char *name, char *filename)
int RemoveList(char* words_file)
{
char fn[FNLEN];
char wordsDir[FNLEN];
LOG("Enter RemoveList()\n");
// get appropriate directory
sprintf(wordsDir, "%s/words", settings.user_settings_path);
if (CheckFile(wordsDir))
{
DEBUGCODE { fprintf(stderr, "User specific wordlist path found: %s\n", wordsDir); }
}
else
{
DEBUGCODE { fprintf(stderr , "Editor: checking directory: %s/words", settings.var_data_path); }
sprintf(wordsDir , "%s/words" , settings.var_data_path);
}
sprintf(fn , "%s/words/%s" , settings.var_data_path, words_file);
sprintf(fn , "%s/%s" , wordsDir, words_file);
DEBUGCODE{ fprintf(stderr, "Remove file %s\n", fn); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment