void SynchronizeLFNs (void) { int i; for (i = 0; i < MAXSFNS; i++) { if ((LongNames[i] != '\0') && (ShortNames[i] != '\0') && (IsLFNSupported (LongNames[i]) == TRUE)) { lfn2sfn95 (LongNames[i], scratchpad); if ((strcmpi (ShortNames[i], scratchpad) != 0) && (Attributes[i].output)) { if (!rename95 (ShortNames[i], LongNames[i])) { rename (ShortNames[i], LongNames[i]); strcpy (ShortNames[i], LongNames[i]); } else lfn2sfn95 (LongNames[i], ShortNames[i]); } } } }
int LFNConvertToSFN(char* file) { static char buffer[67]; if (IsLFNSupported(file)) { if (lfn2sfn95(file, buffer) == 0) { strcpy(file, buffer); return 1; } else return 0; } return 1; }
void ConvertToSFN (char *lfn, int index) { int supported; ShortNames[index][0] = '\0'; /* important */ supported = IsLFNSupported (lfn); if (supported == TRUE) { if (lfn2sfn95 (lfn, ShortNames[index]) != 0) ShortNames[index][0] = '\0'; } else if (supported == MAYBE) ShortNames[index][0] = '\0'; /* Don't know wether LFN is supported. */ else strcpy (ShortNames[index], lfn); strcpy (LongNames[index], lfn); }