diff src/kaigo/horori/alloc/alloc.cpp @ 54:665f92c37b72

small fix.
author pyon@macmini
date Thu, 21 May 2020 22:53:50 +0900
parents 1c7bf24c63e6
children 0369656be06c
line wrap: on
line diff
--- a/src/kaigo/horori/alloc/alloc.cpp	Fri May 15 21:28:41 2020 +0900
+++ b/src/kaigo/horori/alloc/alloc.cpp	Thu May 21 22:53:50 2020 +0900
@@ -1,5 +1,5 @@
 // Filename   : alloc.cpp
-// Last Change: 2020-05-12 火 16:28:18.
+// Last Change: 2020-05-21 木 15:17:26.
 //
 #include <wx/dir.h>
 #include <wx/filefn.h> 
@@ -132,20 +132,18 @@
 
 void AllocFrame::AllocateTif()
 {
-	wxDir dir(m_dirPickerTif->GetPath());
-	if (!dir.IsOpened()) return;
+	wxArrayString files;
+	wxDir::GetAllFiles(m_dirPickerTif->GetPath(), &files, wxT("*.tif"), wxDIR_FILES);
+	files.Sort();
 
-	wxString filename;
-	bool cont = dir.GetFirst(&filename, wxT("*.tif"), wxDIR_FILES);
-
-	for (int i = 0; cont; i++ ) {
+	for (int i = 0; i < files.GetCount(); i++ ) {
 		wxString path = m_dirPickerWork->GetPath() + wxFILE_SEP_PATH + wxString::Format(wxT("%02d"), i / 8 + 1);
 		if (i % 8 == 0) wxFileName::Mkdir(path, wxS_DIR_DEFAULT, 0);
-		wxString fn = filename;
-		cont = dir.GetNext(&filename);
 
 		if (i % 8 == 3 || i % 8 == 5 || i % 8 == 7) continue;
-		wxCopyFile(m_dirPickerTif->GetPath() + wxFILE_SEP_PATH + fn, path + wxFILE_SEP_PATH + fn);
+		wxString to = files[i];
+		to.Replace(m_dirPickerTif->GetPath(), wxEmptyString, false);
+		wxCopyFile(files[i], path + wxFILE_SEP_PATH + to);
 	}
 }