Skip to content

Commit 97bc998

Browse files
authored
add recursive
1 parent de93d56 commit 97bc998

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

localfont.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ bool setFontFiles(std::string folderPath)
2121
/* 指定のディレクトリ以下のファイル名をファイルがなくなるまで取得する */
2222
do {
2323
if (win32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
24-
/* ディレクトリの場合は何もしない */
24+
/* ディレクトリの場合は再帰探索 */
25+
std::string subFolderPath = win32fd.cFileName;
26+
if ((subFolderPath != ".") && (subFolderPath != "..")) {
27+
setFontFiles(folderPath + "/" + subFolderPath);
28+
}
2529
}
2630
else {
27-
std::string fontpath_s = std::string(FONTS_DIR) + "/" + win32fd.cFileName;
31+
std::string fontpath_s = std::string(folderPath) + "/" + win32fd.cFileName;
2832
LPCSTR fontpath = fontpath_s.c_str();
2933
// MessageBox(NULL, fontpath,NULL, MB_OK);
3034
// フォント以外も追加しようとするが無効なのでフィルターより全投げ
@@ -51,4 +55,4 @@ BOOL WINAPI DllMain( HINSTANCE hInstance,DWORD dwNotification,LPVOID lpReserved
5155
return TRUE;
5256
}
5357

54-
int main(int, char**) {}
58+
int main(int, char**) {}

0 commit comments

Comments
 (0)