bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File URLs in NSURL


From: Adam Fedor
Subject: Re: File URLs in NSURL
Date: Thu, 26 Jun 2003 13:15:42 -0600


On Thursday, June 26, 2003, at 10:14 AM, Fred Kiefer wrote:

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



I think GNUstep is wrong, according to RFC 1808.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]