- for(int i = 0 ; i < num_fonts_truetype ; ++i) {
- string const font_current =
- addName(fonts_dir, win_fonts_truetype[i] + ".ttf");
- RemoveFontResource(to_local8bit(from_utf8(external_path(font_current))).c_str());
+ // Translate device name to UNC prefix or drive letters.
+ TCHAR tmpbuf[MAX_PATH] = TEXT("\\Device\\Mup\\");
+ UINT namelen = _tcslen(tmpbuf);
+ if (_tcsnicmp(realpath, tmpbuf, namelen) == 0) {
+ // UNC path
+ _snprintf(tmpbuf, MAX_PATH, "\\\\%s", realpath + namelen);
+ strncpy(realpath, tmpbuf, MAX_PATH);
+ realpath[MAX_PATH] = '\0';
+ } else if (GetLogicalDriveStrings(MAX_PATH - 1, tmpbuf)) {
+ // Check whether device name corresponds to some local drive.
+ TCHAR name[MAX_PATH];
+ TCHAR drive[3] = TEXT(" :");
+ bool found = false;
+ TCHAR * p = tmpbuf;
+ do {
+ // Copy the drive letter to the template string
+ drive[0] = *p;
+ // Look up each device name
+ if (QueryDosDevice(drive, name, MAX_PATH)) {
+ namelen = _tcslen(name);
+ if (namelen < MAX_PATH) {
+ found = _tcsnicmp(realpath, name, namelen) == 0;
+ if (found) {
+ // Repl. device spec with drive
+ TCHAR tempfile[MAX_PATH];
+ _snprintf(tempfile,
+ MAX_PATH,
+ "%s%s",
+ drive,
+ realpath + namelen);
+ strncpy(realpath,
+ tempfile,
+ MAX_PATH);
+ realpath[MAX_PATH] = '\0';
+ }
+ }
+ }
+ // Advance p to the next NULL character.
+ while (*p++) ;
+ } while (!found && *p);