diff --git a/wince/cedict.c b/wince/cedict.c index 8ee88cd6f..7ddd3ab71 100755 --- a/wince/cedict.c +++ b/wince/cedict.c @@ -563,11 +563,7 @@ locateOneDir( MPFORMAL wchar_t* path, OnePathCB cb, void* ctxt, XP_U16 nSought, XP_Bool result = XP_FALSE; XP_U16 startLen; -#if defined TARGET_OS_WINCE lstrcat( path, L"\\" ); -#elif defined TARGET_OS_WIN32 - lstrcat( path, L".\\" ); -#endif startLen = wcslen(path); /* record where we were so can back up */ lstrcat( path, L"*" ); @@ -583,14 +579,18 @@ locateOneDir( MPFORMAL wchar_t* path, OnePathCB cb, void* ctxt, XP_U16 nSought, for ( ; ; ) { if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0){ -#if defined TARGET_OS_WINCE - /* We don't do recursive search on Win32!!! */ - lstrcpy( path+startLen, data.cFileName ); - locateOneDir( MPPARM(mpool) path, cb, ctxt, nSought, nFoundP ); - if ( *nFoundP == nSought ) { - break; + + if ( ( data.cFileName[0] == '.' ) + && ( (data.cFileName[1] == '.') + || (data.cFileName[1] == '\0' ) ) ) { + /* skip . and .. */ + } else { + lstrcpy( path+startLen, data.cFileName ); + locateOneDir( MPPARM(mpool) path, cb, ctxt, nSought, nFoundP ); + if ( *nFoundP == nSought ) { + break; + } } -#endif } else if ( checkIfDictAndLegal( MPPARM(mpool) path, startLen, data.cFileName ) ) { XP_U16 len; @@ -619,14 +619,27 @@ locateOneDir( MPFORMAL wchar_t* path, OnePathCB cb, void* ctxt, XP_U16 nSought, } /* locateOneDir */ XP_U16 -ceLocateNDicts( MPFORMAL XP_U16 nSought, OnePathCB cb, void* ctxt ) +ceLocateNDicts( MPFORMAL HINSTANCE hInstance, XP_U16 nSought, + OnePathCB cb, void* ctxt ) { XP_U16 nFound = 0; - wchar_t pathBuf[CE_MAX_PATH_LEN+1]; + UINT id; - pathBuf[0] = 0; + for ( id = IDS_DICTDIRS; ; ++id ) { + wchar_t pathBuf[CE_MAX_PATH_LEN+1]; + int len = LoadString( hInstance, id, pathBuf, sizeof(pathBuf) ); + XP_LOGF( "%s: LoadString => %d", __FUNCTION__, len ); + if ( len == 0 ) { + break; + } + + locateOneDir( MPPARM(mpool) pathBuf, cb, ctxt, nSought, &nFound ); + + if ( nFound >= nSought ) { + break; + } + } - locateOneDir( MPPARM(mpool) pathBuf, cb, ctxt, nSought, &nFound ); return nFound; } /* ceLocateNthDict */ diff --git a/wince/cedict.h b/wince/cedict.h index a7486b5df..cad996f1d 100755 --- a/wince/cedict.h +++ b/wince/cedict.h @@ -38,7 +38,8 @@ DictionaryCtxt* ce_dictionary_make_empty( CEAppGlobals* globals ); * making sure bufs contains nSought slots. */ typedef XP_Bool (*OnePathCB)( const wchar_t* wPath, XP_U16 index, void* ctxt ); -XP_U16 ceLocateNDicts( MPFORMAL XP_U16 nSought, OnePathCB cb, void* ctxt ); +XP_U16 ceLocateNDicts( MPFORMAL HINSTANCE hInstance, XP_U16 nSought, + OnePathCB cb, void* ctxt ); XP_UCHAR* bname( XP_UCHAR* in ); diff --git a/wince/ceginfo.c b/wince/ceginfo.c index b6c514408..2a450e9a3 100755 --- a/wince/ceginfo.c +++ b/wince/ceginfo.c @@ -211,8 +211,8 @@ loadFromGameInfo( HWND hDlg, CEAppGlobals* globals, GameInfoState* giState ) (XP_U16)XP_STRLEN(gi->dictName)+1 ); } if ( giState->isNewGame ) { - (void)ceLocateNDicts( MPPARM(globals->mpool) 32, addDictToMenu, - giState ); + (void)ceLocateNDicts( MPPARM(globals->mpool) globals->hInst, 32, + addDictToMenu, giState ); if ( !giState->curSelSet ) { SendDlgItemMessage( giState->hDlg, IDC_DICTCOMBO, CB_SETCURSEL, 0, 0L ); diff --git a/wince/cemain.c b/wince/cemain.c index 36f143fce..80cc239e2 100755 --- a/wince/cemain.c +++ b/wince/cemain.c @@ -969,7 +969,8 @@ InitInstance(HINSTANCE hInstance, int nCmdShow) /* choose one. If none found it's an error. */ #ifndef STUBBED_DICT - result = 1 == ceLocateNDicts(MPPARM(mpool) 1, ceSetDictName, globals ); + result = 1 == ceLocateNDicts( MPPARM(mpool) hInstance, 1, ceSetDictName, + globals ); if ( !result ) { messageBoxChar( globals, "Please install at least one Crosswords " "dictionary.", L"Fatal error" ); diff --git a/wince/resource.h b/wince/resource.h index 93ce20ed3..e016d6ca4 100755 --- a/wince/resource.h +++ b/wince/resource.h @@ -184,6 +184,10 @@ #define IDS_FILE 40002 #define IDS_GAME 40003 #define IDS_MOVE 40004 +// Don't use the numbers after 4005: one string needs not to be there +// to stop the progression in cedict.c +#define IDS_DICTDIRS 40005 + // Next default values for new objects // #ifdef APSTUDIO_INVOKED diff --git a/wince/xwords4.rc b/wince/xwords4.rc index d1db3d830..a198b9ed5 100755 --- a/wince/xwords4.rc +++ b/wince/xwords4.rc @@ -249,7 +249,8 @@ BEGIN EDITTEXT PASS_EDIT4,GAME_PWD_LEFT,PLAYER_ROW_4,20,ROW_HEIGHT, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "Dictionary:",IDC_STATIC,LEFT_COL,DICTPICK_ROW,36,8,SS_NOPREFIX + LTEXT "Dictionary:",IDC_STATIC,LEFT_COL,DICTPICK_ROW,36,8, + SS_NOPREFIX COMBOBOX IDC_DICTCOMBO,43,DICTPICK_ROW,85,58, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -662,6 +663,12 @@ BEGIN IDS_FILE "File" IDS_GAME "Game" IDS_MOVE "Move" +#ifdef _WIN32 + IDS_DICTDIRS "." +#else + IDS_DICTDIRS "\\Program Files\\Crosswords" + IDS_DICTDIRS+1 "\\SD Card\\Crosswords" +#endif END #endif // English (U.S.) resources