2 * Copyright (c) 2000, Red Hat, Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * A copy of the GNU General Public License can be found at
12 * Written by DJ Delorie <dj@cygnus.com>
16 /* The purpose of this file is to handle the case where we're
17 installing from files that already exist in the current directory.
18 If a setup.ini file is present, we set the mirror site to "." and
19 pretend we're installing from the `internet' ;-) else we have to
20 find all the .tar.gz files, deduce their versions, and try to
21 compare versions in the case where the current directory contains
22 multiple versions of any given package. We do *not* try to compare
23 versions with already installed packages; we always choose a
24 package in the current directory over one that's already installed
25 (otherwise, why would you have asked to install it?). Note
26 that we search recursively. */
29 static const char *cvsid
=
44 #include "ScanFindVisitor.h"
45 #include "filemanip.h"
50 #include "IniDBBuilderPackage.h"
52 /* Trivial class for detecting the existence of setup.ini */
54 class SetupFindVisitor
: public FindVisitor
57 SetupFindVisitor (): found(false){}
58 virtual void visitFile(String
const &basePath
, const WIN32_FIND_DATA
*theFile
)
60 if (!String ("setup.ini").casecompare(theFile
->cFileName
) &&
61 (theFile
->nFileSizeLow
|| theFile
->nFileSizeHigh
))
64 virtual ~ SetupFindVisitor (){}
65 operator bool () const {return found
;}
67 SetupFindVisitor (SetupFindVisitor
const &);
68 SetupFindVisitor
& operator= (SetupFindVisitor
const &);
74 do_fromcwd (HINSTANCE h
, HWND owner
)
76 // Assume we won't find the INI file.
77 SetupFindVisitor found_ini
;
78 Find(".").accept(found_ini
);
81 // Found INI, load it.
82 next_dialog
= IDD_S_LOAD_INI
;
86 next_dialog
= IDD_CHOOSE
;
88 IniDBBuilderPackage myBuilder
;
89 ScanFindVisitor
myVisitor (myBuilder
);
90 Find(".").accept(myVisitor
);