Tuesday, October 26, 2010

Turbo Pascal 5.5 on iPhone 4

Apple just approved the DOS emulator iDOS and we were interested to see if some of the old DOS versions of Turbo Pascal from the Borland museum worked. So rotate your head 90 degrees to the right and take a look below (image screen capture straight from iPhone 4 without modification):


Everything except the debugger appears to be working. Without the debugger it'd be a little difficult to use.

Monday, October 11, 2010

Case Sensitive File System on OSX

I recently had to determine if the file system was case sensitive on OSX. It was actually throw away work but figured I'd post it to my blog in case anyone else out there needed to do the same thing and didn't want to start from scratch.

#include <CoreServices/CoreServices.h>
#include <CoreFoundation/CFString.h>

BOOL IsFileSystemCaseSensitive(const char* path)
{
  FSRef ref;
  FSCatalogInfo info;
  GetVolParmsInfoBuffer buffer;

  if ((FSPathMakeRef((const UInt8*)path, &ref, NULL) == noErr) &&
      (FSGetCatalogInfo(&ref, kFSCatInfoVolume, &info, NULL, NULL, NULL) == noErr) &&
      (FSGetVolumeParms(info.volume, &buffer, sizeof(buffer)) == noErr) &&
      (buffer.vMVersion > 2))
  {
    if ((buffer.vMExtendedAttributes & (1 << bIsCaseSensitive)) != 0)
      return TRUE;
  }
  return FALSE:
}

If the path parameter is simply an ANSI string then this function works fine. However, if it is a unicode string, then you'll need to call CFStringGetFileSystemRepresentation to get everything encoded correctly.