diff --git a/words/cordle_words_cultural.txt b/WORDS/cultural.txt similarity index 100% rename from words/cordle_words_cultural.txt rename to WORDS/cultural.txt diff --git a/words/cordle_words.txt b/WORDS/default.txt similarity index 100% rename from words/cordle_words.txt rename to WORDS/default.txt diff --git a/words/cordle_words_easy.txt b/WORDS/easy.txt similarity index 100% rename from words/cordle_words_easy.txt rename to WORDS/easy.txt diff --git a/words/cordle_words_full.txt b/WORDS/full.txt similarity index 100% rename from words/cordle_words_full.txt rename to WORDS/full.txt diff --git a/words/cordle_words_hard.txt b/WORDS/hard.txt similarity index 100% rename from words/cordle_words_hard.txt rename to WORDS/hard.txt diff --git a/words/cordle_words_literary.txt b/WORDS/literary.txt similarity index 100% rename from words/cordle_words_literary.txt rename to WORDS/literary.txt diff --git a/words/cordle_words_medium.txt b/WORDS/medium.txt similarity index 100% rename from words/cordle_words_medium.txt rename to WORDS/medium.txt diff --git a/words/cordle_words_techy.txt b/WORDS/techy.txt similarity index 100% rename from words/cordle_words_techy.txt rename to WORDS/techy.txt diff --git a/include/platform.h b/include/platform.h index 8907316..41ab226 100644 --- a/include/platform.h +++ b/include/platform.h @@ -17,10 +17,10 @@ /* DOS path definitions */ #define PATH_SEP "\\" - #define WORDLIST_PATH_1 "words" - #define WORDLIST_PATH_2 "C:\\CORDLE\\words" - #define WORDLIST_PATH_4 "D:\\CORDLE\\words" - #define WORDLIST_PATH_3 NULL + #define WORDLIST_PATH_1 "WORDS" + #define WORDLIST_PATH_2 "D:\\CORDLE\\WORDS" + #define WORDLIST_PATH_3 "C:\\CORDLE\\WORDS" + #define WORDLIST_PATH_4 NULL /* DOS doesn't have HOME environment variable */ #define HAS_HOME_ENV 0 @@ -30,9 +30,10 @@ /* Unix path definitions */ #define PATH_SEP "/" - #define WORDLIST_PATH_1 "words" - #define WORDLIST_PATH_2 "/usr/local/share/cordle/words" - #define WORDLIST_PATH_3_FMT "%s/.local/share/cordle/words" + #define WORDLIST_PATH_1 "WORDS" + #define WORDLIST_PATH_2 "/usr/local/share/cordle/WORDS" + #define WORDLIST_PATH_3 "%s/.local/share/cordle/WORDS"" + #define WORDLIST_PATH_3_FMT "%s/.local/share/cordle/WORDS" #define HAS_HOME_ENV 1 #endif diff --git a/src/main.c b/src/main.c index f3ca2bd..07f8204 100644 --- a/src/main.c +++ b/src/main.c @@ -19,30 +19,30 @@ static void parse_arguments(int argc, char **argv, char *filename, char *difficu int i; /* Default values */ - strcpy(filename, "cordle_words_easy.txt"); - strcpy(difficulty, "EASY"); + strcpy(filename, "default.txt"); + strcpy(difficulty, "DEFAULT"); for (i = 1; i < argc; i++) { if (strcmp(argv[i], "--easy") == 0) { - strcpy(filename, "cordle_words_easy.txt"); + strcpy(filename, "easy.txt"); strcpy(difficulty, "EASY"); } else if (strcmp(argv[i], "--medium") == 0) { - strcpy(filename, "cordle_words_medium.txt"); + strcpy(filename, "medium.txt"); strcpy(difficulty, "MEDIUM"); } else if (strcmp(argv[i], "--hard") == 0) { - strcpy(filename, "cordle_words_hard.txt"); + strcpy(filename, "hard.txt"); strcpy(difficulty, "HARD"); } else if (strcmp(argv[i], "--techy") == 0) { - strcpy(filename, "cordle_words_techy.txt"); + strcpy(filename, "techy.txt"); strcpy(difficulty, "TECHNICAL"); } else if (strcmp(argv[i], "--literary") == 0) { - strcpy(filename, "cordle_words_literary.txt"); + strcpy(filename, "literary.txt"); strcpy(difficulty, "LITERARY"); } else if (strcmp(argv[i], "--cultural") == 0) { - strcpy(filename, "cordle_words_cultural.txt"); + strcpy(filename, "cultural.txt"); strcpy(difficulty, "CULTURAL"); } else if (strcmp(argv[i], "--full") == 0) { - strcpy(filename, "cordle_words_full.txt"); + strcpy(filename, "full.txt"); strcpy(difficulty, "FULL"); } else if (strcmp(argv[i], "--wordlist") == 0 && i + 1 < argc) { strcpy(filename, argv[i + 1]); @@ -90,8 +90,8 @@ static int main_game_loop(int argc, char *argv[]) { if (!load_words(&game, filename)) { /* Try fallback */ - if (strcmp(filename, "cordle_words.txt") != 0 && - load_words(&game, "cordle_words.txt")) { + if (strcmp(filename, "default.txt") != 0 && + load_words(&game, "default.txt")) { strcpy(difficulty, "DEFAULT"); } else { mvaddstr(0, 0, "Error: Could not load word list"); diff --git a/src/words.c b/src/words.c index 21df5e8..dffbe05 100644 --- a/src/words.c +++ b/src/words.c @@ -18,16 +18,22 @@ static FILE *open_wordlist(const char *filename) { const char *home; #endif - /* Try 1: wordlists/ relative to the current directory (for development) */ + /* Try 1: WORDS/ relative to the current directory (for development) */ sprintf(filepath, "%s%s%s", WORDLIST_PATH_1, PATH_SEP, filename); file = fopen(filepath, "r"); if (file) return file; - /* Try 2: system installation path */ + /* Try 2: D drive installation path */ sprintf(filepath, "%s%s%s", WORDLIST_PATH_2, PATH_SEP, filename); file = fopen(filepath, "r"); if (file) return file; + /* Try 2: C drive installation path */ + sprintf(filepath, "%s%s%s", WORDLIST_PATH_3, PATH_SEP, filename); + file = fopen(filepath, "r"); + if (file) return file; + + #if HAS_HOME_ENV /* Try 3: ${HOME}/.local/share/cordle/wordlists/ (Unix user installation) */ home = getenv("HOME");