[Tux4kids-commits] r1653 - in tuxtype/trunk: doc src

Matthew Trey treymd-guest at alioth.debian.org
Sat Nov 14 17:39:49 UTC 2009


Author: treymd-guest
Date: 2009-11-14 17:39:49 +0000 (Sat, 14 Nov 2009)
New Revision: 1653

Modified:
   tuxtype/trunk/doc/TODO
   tuxtype/trunk/src/editor.c
Log:
removed remaining hard-coded word list paths in wordlist editor

Modified: tuxtype/trunk/doc/TODO
===================================================================
--- tuxtype/trunk/doc/TODO	2009-11-14 17:14:04 UTC (rev 1652)
+++ tuxtype/trunk/doc/TODO	2009-11-14 17:39:49 UTC (rev 1653)
@@ -19,4 +19,8 @@
 
 -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.
 

Modified: tuxtype/trunk/src/editor.c
===================================================================
--- tuxtype/trunk/src/editor.c	2009-11-14 17:14:04 UTC (rev 1652)
+++ tuxtype/trunk/src/editor.c	2009-11-14 17:39:49 UTC (rev 1653)
@@ -501,14 +501,28 @@
   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 @@
   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 @@
   /* 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 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); }
 




More information about the Tux4kids-commits mailing list