MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / GetImageTitle

Function GetImageTitle

source/DiskImage.cpp:274–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274void GetImageTitle(LPCTSTR pPathname, std::string & pImageName, std::string & pFullName)
275{
276 char imagetitle[ MAX_DISK_FULL_NAME+1 ];
277 LPCTSTR startpos = pPathname;
278
279 // imagetitle = <FILENAME.EXT>
280 if (strrchr(startpos, PATH_SEPARATOR))
281 startpos = strrchr(startpos, PATH_SEPARATOR)+1;
282
283 strncpy(imagetitle, startpos, MAX_DISK_FULL_NAME);
284 imagetitle[MAX_DISK_FULL_NAME] = 0;
285
286 // if imagetitle contains a lowercase char, then found=1 (why?)
287 BOOL found = 0;
288 int loop = 0;
289 while (imagetitle[loop] && !found)
290 {
291 if (IsCharLower(imagetitle[loop]))
292 found = 1;
293 else
294 loop++;
295 }
296
297 if ((!found) && (loop > 2))
298 CharLowerBuff(imagetitle+1, (uint32_t)strlen(imagetitle+1));
299
300 // pFullName = <FILENAME.EXT>
301 pFullName = imagetitle;
302
303 if (imagetitle[0])
304 {
305 LPTSTR dot = imagetitle;
306 if (strrchr(dot, '.'))
307 dot = strrchr(dot, '.');
308 if (dot > imagetitle)
309 *dot = 0;
310 }
311
312 // pImageName = <FILENAME> (ie. no extension)
313 pImageName = imagetitle;
314}

Callers 4

InsertDiskMethod · 0.85
InsertMethod · 0.85
InitComboFloppyDriveMethod · 0.85
InitComboHDDMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected