While playing around with thumbnails (thanks to Charles Philip Chan
for the link!) I came up with the following code:
file = @"~/GNUstep/Images/TextSystem1.png";
absolute = [file stringByStandardizingPath];
NSLog(@"file: %@, absolute: %@", file, absolute);
absolute = [[NSURL fileURLWithPath: absolute] relativeString];
digest = [[[[absolute dataUsingEncoding: NSASCIIStringEncoding]
md5Digest] hexadecimalRepresentation] lowercaseString];
NSLog(@"file: %@, absolute: %@, digest %@", file, absolute, digest);
file = [[[@"~" stringByAppendingPathComponent: @".thumbnails"]
stringByAppendingPathComponent: @"normal"]
stringByAppendingPathComponent:
[digest stringByAppendingPathExtension: @"png"]];
image = [[NSImage alloc] initByReferencingFile: file];
But this does not give the correct result. According to the
specification the URL file name "absolute" should be something like
file:///home/fred/GNUstep/Images/TextSystem1.png
but in GNUStep I do get:
file:/home/fred/GNUstep/Images/TextSystem1.png