comparison 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
comparison
equal deleted inserted replaced
53:8df74a781c8c 54:665f92c37b72
1 // Filename : alloc.cpp 1 // Filename : alloc.cpp
2 // Last Change: 2020-05-12 火 16:28:18. 2 // Last Change: 2020-05-21 木 15:17:26.
3 // 3 //
4 #include <wx/dir.h> 4 #include <wx/dir.h>
5 #include <wx/filefn.h> 5 #include <wx/filefn.h>
6 #include <wx/textfile.h> 6 #include <wx/textfile.h>
7 #include <wx/utils.h> 7 #include <wx/utils.h>
130 wxExecute(batchfile, wxEXEC_SYNC|wxEXEC_HIDE_CONSOLE, NULL, NULL); 130 wxExecute(batchfile, wxEXEC_SYNC|wxEXEC_HIDE_CONSOLE, NULL, NULL);
131 } 131 }
132 132
133 void AllocFrame::AllocateTif() 133 void AllocFrame::AllocateTif()
134 { 134 {
135 wxDir dir(m_dirPickerTif->GetPath()); 135 wxArrayString files;
136 if (!dir.IsOpened()) return; 136 wxDir::GetAllFiles(m_dirPickerTif->GetPath(), &files, wxT("*.tif"), wxDIR_FILES);
137 files.Sort();
137 138
138 wxString filename; 139 for (int i = 0; i < files.GetCount(); i++ ) {
139 bool cont = dir.GetFirst(&filename, wxT("*.tif"), wxDIR_FILES);
140
141 for (int i = 0; cont; i++ ) {
142 wxString path = m_dirPickerWork->GetPath() + wxFILE_SEP_PATH + wxString::Format(wxT("%02d"), i / 8 + 1); 140 wxString path = m_dirPickerWork->GetPath() + wxFILE_SEP_PATH + wxString::Format(wxT("%02d"), i / 8 + 1);
143 if (i % 8 == 0) wxFileName::Mkdir(path, wxS_DIR_DEFAULT, 0); 141 if (i % 8 == 0) wxFileName::Mkdir(path, wxS_DIR_DEFAULT, 0);
144 wxString fn = filename;
145 cont = dir.GetNext(&filename);
146 142
147 if (i % 8 == 3 || i % 8 == 5 || i % 8 == 7) continue; 143 if (i % 8 == 3 || i % 8 == 5 || i % 8 == 7) continue;
148 wxCopyFile(m_dirPickerTif->GetPath() + wxFILE_SEP_PATH + fn, path + wxFILE_SEP_PATH + fn); 144 wxString to = files[i];
145 to.Replace(m_dirPickerTif->GetPath(), wxEmptyString, false);
146 wxCopyFile(files[i], path + wxFILE_SEP_PATH + to);
149 } 147 }
150 } 148 }
151 149
152 /* Event Handlers */ 150 /* Event Handlers */
153 void AllocFrame::OnAlloc(wxCommandEvent& WXUNUSED(event)) 151 void AllocFrame::OnAlloc(wxCommandEvent& WXUNUSED(event))