Skip to content

Commit

Permalink
Show progress
Browse files Browse the repository at this point in the history
  • Loading branch information
kobake committed Jun 27, 2020
1 parent 7a2f29f commit 1b10812
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions updatedb32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ int main_routine()
//書き込み終了
out.Close();

// 完了メッセージ
wprintf(L"done.\n");

//現在のドライブを取得
// const wchar_t* p = wcschr(szCurDir, L'\\');
// if(!p)p = wcschr(szCurDir, L'\0');
Expand All @@ -115,12 +118,22 @@ void enum_and_print_start(CFileOutputStream& out, wchar_t* szDir)
enum_and_print(out, szDir, 1);
}

// 経過時間
ULONGLONG g_lastPrint = 0;

// アイテムのサイズを返す
long long enum_and_print(CFileOutputStream& out, wchar_t* szDir, int nIndent)
{
//CPUをあんまり食いつぶさないように。
::Sleep(1);

// 定期的に情報出力
ULONGLONG t = GetTickCount64();
if (t - g_lastPrint >= 200) { // 前回 print より0.2秒以上経過していたら
wprintf(L"... %ls\n", szDir);
g_lastPrint = t;
}

//ワイルドカード式ファイルパスを構築
wchar_t* szPath = szDir;
wcscat_s(szPath, XP_MAX_PATH, L"\\*");
Expand Down

0 comments on commit 1b10812

Please sign in to comment.