netio.h \
nio-ie5.cc \
nio-ie5.h \
- nio-file.cc \
- nio-file.h \
nio-http.cc \
nio-http.h \
package_db.cc \
#include "resource.h"
#include "state.h"
#include "msg.h"
-#include "nio-file.h"
#include "nio-ie5.h"
#include "nio-http.h"
#include "dialog.h"
NetIO::open (char const *url, bool cachable)
{
NetIO *rv = 0;
+ std::string file_url;
+
enum
{ http, https, ftp, ftps, file }
proto;
proto = ftp;
else if (strncmp (url, "ftps://", 7) == 0)
proto = ftps;
- else
+ else if (strncmp (url, "file://", 7) == 0)
proto = file;
+ else
+ {
+ proto = file;
+ file_url = (std::string("file://") + url);
+ url = file_url.c_str();
+ }
if (proto == file)
- rv = new NetIO_File (url);
+ rv = new NetIO_IE5 (url, true, false);
else if (net_method == IDC_NET_PRECONFIG)
rv = new NetIO_IE5 (url, false, cachable);
else if (net_method == IDC_NET_PROXY)
+++ /dev/null
-/*
- * Copyright (c) 2000, Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * A copy of the GNU General Public License can be found at
- * http://www.gnu.org/
- *
- * Written by DJ Delorie <dj@cygnus.com>
- *
- */
-
-/* The purpose of this file is to manage access to files stored on the
- local disk (i.e. "downloading" setup.ini). Called from netio.cc */
-
-#include "win32.h"
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include "netio.h"
-#include "nio-file.h"
-#include "resource.h"
-#include "msg.h"
-#include "filemanip.h"
-#include "LogSingleton.h"
-
-NetIO_File::NetIO_File (char const *Purl):
-NetIO (Purl)
-{
- fd = nt_fopen (path, "rb");
- if (fd)
- {
- file_size = get_file_size (std::string("file://") + path);
- }
- else
- {
- const char *err = strerror (errno);
- if (!err)
- err = "(unknown error)";
- Log (LOG_BABBLE) << "Can't open " << path << " for reading: " << err << endLog;
- }
-}
-
-NetIO_File::~NetIO_File ()
-{
- if (fd)
- fclose ((FILE *) fd);
-}
-
-int
-NetIO_File::ok ()
-{
- return fd ? 1 : 0;
-}
-
-int
-NetIO_File::read (char *buf, int nbytes)
-{
- return fread (buf, 1, nbytes, (FILE *) fd);
-}
+++ /dev/null
-/*
- * Copyright (c) 2000, Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * A copy of the GNU General Public License can be found at
- * http://www.gnu.org/
- *
- * Written by DJ Delorie <dj@cygnus.com>
- *
- */
-
-#ifndef SETUP_NIO_FILE_H
-#define SETUP_NIO_FILE_H
-
-/* see nio-file.cc */
-
-class NetIO_File:public NetIO
-{
-public:
- NetIO_File (char const *url);
- void *fd;
- ~NetIO_File ();
- virtual int ok ();
- virtual int read (char *buf, int nbytes);
-};
-
-#endif /* SETUP_NIO_FILE_H */