@@ -443,10 +443,11 @@ return (id)[[OFString_UTF8 alloc] initWithContentsOfFile: path encoding: encoding]; } #endif +#if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS) - initWithContentsOfURL: (OFURL*)URL { return (id)[[OFString_UTF8 alloc] initWithContentsOfURL: URL]; } @@ -454,10 +455,11 @@ encoding: (of_string_encoding_t)encoding { return (id)[[OFString_UTF8 alloc] initWithContentsOfURL: URL encoding: encoding]; } +#endif - initWithSerialization: (OFXMLElement*)element { return (id)[[OFString_UTF8 alloc] initWithSerialization: element]; } @@ -635,10 +637,11 @@ return [[[self alloc] initWithContentsOfFile: path encoding: encoding] autorelease]; } #endif +#if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS) + (instancetype)stringWithContentsOfURL: (OFURL*)URL { return [[[self alloc] initWithContentsOfURL: URL] autorelease]; } @@ -646,10 +649,11 @@ encoding: (of_string_encoding_t)encoding { return [[[self alloc] initWithContentsOfURL: URL encoding: encoding] autorelease]; } +#endif + (OFString*)pathWithComponents: (OFArray*)components { OFMutableString *ret = [OFMutableString string]; void *pool = objc_autoreleasePoolPush(); @@ -861,10 +865,11 @@ return self; } #endif +#if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS) - initWithContentsOfURL: (OFURL*)URL { return [self initWithContentsOfURL: URL encoding: OF_STRING_ENCODING_AUTODETECT]; } @@ -872,30 +877,30 @@ - initWithContentsOfURL: (OFURL*)URL encoding: (of_string_encoding_t)encoding { void *pool; OFString *scheme; -#ifdef OF_HAVE_FILES +# ifdef OF_HAVE_FILES Class c = [self class]; -#endif +# endif [self release]; pool = objc_autoreleasePoolPush(); scheme = [URL scheme]; -#ifdef OF_HAVE_FILES +# ifdef OF_HAVE_FILES if ([scheme isEqual: @"file"]) { if (encoding == OF_STRING_ENCODING_AUTODETECT) encoding = OF_STRING_ENCODING_UTF_8; self = [[c alloc] initWithContentsOfFile: [URL path] encoding: encoding]; } else -#endif -#ifdef OF_HAVE_SOCKETS +# endif +# ifdef OF_HAVE_SOCKETS if ([scheme isEqual: @"http"] || [scheme isEqual: @"https"]) { OFHTTPClient *client = [OFHTTPClient client]; OFHTTPRequest *request = [OFHTTPRequest requestWithURL: URL]; OFHTTPResponse *response = [client performRequest: request]; OFDictionary *headers; @@ -937,17 +942,18 @@ self = [[c alloc] initWithCString: (char*)[data items] encoding: encoding length: [data count]]; } else -#endif +# endif @throw [OFUnsupportedProtocolException exception]; objc_autoreleasePoolPop(pool); return self; } +#endif - initWithSerialization: (OFXMLElement*)element { @try { void *pool = objc_autoreleasePoolPush();