MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / Execute

Method Execute

Engine/source/platform/nativeDialogs/fileDialog.cpp:185–308  ·  view source on GitHub ↗

Execute Method

Source from the content-addressed store, hash-verified

183// Execute Method
184//
185bool FileDialog::Execute()
186{
187 String strippedFilters;
188
189 U32 filtersCount = StringUnit::getUnitCount(mData.mFilters, "|");
190
191 for (U32 i = 1; i < filtersCount; ++i)
192 {
193 //The first of each pair is the name, which we'll skip because NFD doesn't support named filters atm
194 String filter = StringUnit::getUnit(mData.mFilters, i, "|");
195
196 if (!dStrcmp(filter.c_str(), "*.*"))
197 continue;
198
199 U32 subFilterCount = StringUnit::getUnitCount(filter, ";");
200
201 //if we have a 'super filter', break it down to sub-options as well
202 if (subFilterCount > 1)
203 {
204 String suffixFilter;
205 String subFilters;
206
207 for (U32 f = 0; f < subFilterCount; ++f)
208 {
209 String subFilter = StringUnit::getUnit(filter, f, ";");
210
211 suffixFilter += String::ToLower(subFilter) + "," + String::ToUpper(subFilter) + ",";
212 subFilters += String::ToLower(subFilter) + "," + String::ToUpper(subFilter) + ";";
213 }
214
215 suffixFilter = suffixFilter.substr(0, suffixFilter.length() - 1);
216 suffixFilter += ";";
217
218 strippedFilters += suffixFilter + subFilters;
219 }
220 else //otherwise, just add the filter
221 {
222 strippedFilters += String::ToLower(filter) + "," + String::ToUpper(filter) + ";";
223 }
224
225 ++i;
226 if (i < filtersCount - 2)
227 strippedFilters += String(";");
228 }
229
230 //strip the last character, if it's unneeded
231 if (strippedFilters.endsWith(";"))
232 {
233 strippedFilters = strippedFilters.substr(0, strippedFilters.length() - 1);
234 }
235
236 strippedFilters.replace("*.", "");
237
238 // Get the current working directory, so we can back up to it once Windows has
239 // done its craziness and messed with it.
240 StringTableEntry cwd = Platform::getCurrentDirectory();
241 if (mData.mDefaultPath == StringTable->lookup("") || !Platform::isDirectory(mData.mDefaultPath))
242 mData.mDefaultPath = cwd;

Callers 15

fileDialogs.ed.csFile · 0.45
ForestEditorGuiFunction · 0.45
roadEditorGui.csFile · 0.45
EditorSaveMissionAsFunction · 0.45
menuHandlers.ed.csFile · 0.45
fileDialogs.ed.csFile · 0.45
ForestEditorGuiFunction · 0.45

Calls 15

getUnitCountFunction · 0.85
getUnitFunction · 0.85
ToLowerFunction · 0.85
ToUpperFunction · 0.85
errorfFunction · 0.85
NFD_GetErrorFunction · 0.85
NFD_PathSet_GetCountFunction · 0.85
NFD_PathSet_GetPathFunction · 0.85
getIntArgFunction · 0.85
substrMethod · 0.80
endsWithMethod · 0.80
replaceMethod · 0.80

Tested by

no test coverage detected