}
int
-archive::extract_file (archive * source, const char *prefix, const char *suffix)
+archive::extract_file (archive * source, const char *prefixURL, const char *prefixPath, const char *suffix)
{
if (!source)
return 1;
- const char *destfilename = concat (prefix, source->next_file_name (), suffix, 0);
+ const char *destfilename = concat (prefixURL,prefixPath, source->next_file_name (), suffix, 0);
switch (source->next_file_type ())
{
case ARCHIVE_FILE_REGULAR:
io_stream::remove (destfilename);
int ok =
io_stream::mklink (destfilename,
- concat (prefix, source->linktarget (), 0),
+ concat (prefixURL, source->linktarget (), 0),
IO_STREAM_SYMLINK);
/* FIXME: check what tar's filelength is set to for symlinks */
source->skip_file ();
io_stream::remove (destfilename);
int ok =
io_stream::mklink (destfilename,
- concat (prefix, source->linktarget (), 0),
+ concat (prefixURL, source->linktarget (), 0),
IO_STREAM_HARDLINK);
/* FIXME: check what tar's filelength is set to for hardlinks */
source->skip_file ();
* The stream is not taken over - it will not be automatically deleted
*/
virtual io_stream *extract_file () = NULL;
- /* extract the next file to the given prefix in one step, and name it with the
+ /* extract the next file to the given prefixURL+Path in one step, and name it with the
* given suffix.
* returns 1 on failure.
*/
- static int extract_file (archive *, const char *, const char * = NULL);
+ static int extract_file (archive *, const char *, const char *, const char * = NULL);
/*
* To create a stream that will be compressed, you should open the url, and then get a new stream
static void uninstall_one (packagemeta &);
static int replace_one (packagemeta &);
static int install_one_source (packagemeta &, packagesource &, char const *,
- package_type_t);
+ char const *, package_type_t);
static bool rebootneeded;
/* FIXME: upgrades should be a method too */
pkg.uninstall ();
errors +=
- install_one_source (pkg, pkg.desired->bin, "cygfile:///", package_binary);
+ install_one_source (pkg, pkg.desired->bin, "cygfile://","/", package_binary);
if (!errors)
pkg.installed = pkg.desired;
num_replacements++;
/* install one source at a given prefix. */
static int
install_one_source (packagemeta & pkgm, packagesource & source,
- char const *prefix, package_type_t type)
+ char const *prefixURL, char const *prefixPath, package_type_t type)
{
int errors = 0;
Progress.SetText2 (source.Base ());
lst->write (concat (fn, "\n", 0), strlen (fn) + 1);
/* FIXME: concat leaks memory */
- Progress.SetText3 (concat (prefix, fn, 0));
- log (LOG_BABBLE, "Installing file %s%s", prefix, fn);
- if (archive::extract_file (thefile, prefix) != 0)
+ Progress.SetText3 (concat (prefixPath, fn, 0));
+ log (LOG_BABBLE, "Installing file %s%s%s", prefixURL,prefixPath, fn);
+ if (archive::extract_file (thefile, prefixURL, prefixPath) != 0)
{
//extract to temp location
- if (archive::extract_file (thefile, prefix, ".new") != 0)
+ if (archive::extract_file (thefile, prefixURL, prefixPath, ".new") != 0)
{
- log (0, "Unable to install file %s%s", prefix, fn);
+ log (0, "Unable to install file %s%s%s", prefixURL,prefixPath, fn);
errors++;
}
else
if (pkg.installed != pkg.desired && pkg.desired->binpicked)
{
errors +=
- install_one_source (pkg, pkg.desired->bin, "cygfile:///",
+ install_one_source (pkg, pkg.desired->bin, "cygfile://","/",
package_binary);
if (!errors)
pkg.installed = pkg.desired;
}
if (pkg.desired->srcpicked)
errors +=
- install_one_source (pkg, pkg.desired->src, "cygfile:///usr/src",
+ install_one_source (pkg, pkg.desired->src, "cygfile://","/usr/src",
package_source);
/* FIXME: make a upgrade method and reinstate this */