Rework by Frederic for better windows support.
Added MSVC7 workspace files. Switch from libtar to untarka for it's better windows support.
This commit is contained in:
parent
3daf9e5a2d
commit
35f63ba709
10 changed files with 1650 additions and 146 deletions
|
@ -10,7 +10,7 @@ dnl Require at least automake 2.52
|
||||||
AC_PREREQ(2.52)
|
AC_PREREQ(2.52)
|
||||||
|
|
||||||
dnl Initialize the automake stuff
|
dnl Initialize the automake stuff
|
||||||
AM_INIT_AUTOMAKE(fgadmin, 1.0)
|
AM_INIT_AUTOMAKE(fgadmin, 1.0.0)
|
||||||
|
|
||||||
dnl Checks for programs.
|
dnl Checks for programs.
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
|
@ -162,6 +162,8 @@ if test "x$ac_cv_header_zlib_h" != "xyes"; then
|
||||||
echo "configure aborted."
|
echo "configure aborted."
|
||||||
echo
|
echo
|
||||||
exit
|
exit
|
||||||
|
else
|
||||||
|
AC_DEFINE([HAVE_ZLIB], 1, [Define to enable gz compressed tar archives])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Check for system installed zlib
|
dnl Check for system installed zlib
|
||||||
|
|
|
@ -6,7 +6,9 @@ fgadmin_SOURCES = \
|
||||||
fgadmin.cxx fgadmin.h \
|
fgadmin.cxx fgadmin.h \
|
||||||
fgadmin_funcs.cxx \
|
fgadmin_funcs.cxx \
|
||||||
main.cxx \
|
main.cxx \
|
||||||
tar_utils.cxx tar_utils.hxx
|
untarka.c untarka.h
|
||||||
|
|
||||||
fgadmin_LDADD = -lsgmisc -lplibul -ltar -lz
|
fgadmin_LDADD = -lsgmisc -lplibul -ltar -lz
|
||||||
|
|
||||||
|
fgadmin.cxx fgadmin.h: fgadmin.fl
|
||||||
|
fluid -c fgadmin.fl
|
||||||
|
|
|
@ -40,6 +40,9 @@
|
||||||
/* Define to 1 if you have the `unlink' function. */
|
/* Define to 1 if you have the `unlink' function. */
|
||||||
#define HAVE_UNLINK 1
|
#define HAVE_UNLINK 1
|
||||||
|
|
||||||
|
/* Define to enable gz compressed tar archives */
|
||||||
|
#define HAVE_ZLIB 1
|
||||||
|
|
||||||
/* Name of package */
|
/* Name of package */
|
||||||
#define PACKAGE "fgadmin"
|
#define PACKAGE "fgadmin"
|
||||||
|
|
||||||
|
@ -68,7 +71,7 @@
|
||||||
/* #undef TM_IN_SYS_TIME */
|
/* #undef TM_IN_SYS_TIME */
|
||||||
|
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#define VERSION "1.0"
|
#define VERSION "1.0.0"
|
||||||
|
|
||||||
/* Define to empty if `const' does not conform to ANSI C. */
|
/* Define to empty if `const' does not conform to ANSI C. */
|
||||||
/* #undef const */
|
/* #undef const */
|
||||||
|
|
|
@ -20,7 +20,7 @@ class FGAdminUI {open selected
|
||||||
} {
|
} {
|
||||||
Fl_Window main_window {
|
Fl_Window main_window {
|
||||||
label {FlightGear Admin Wizard} open
|
label {FlightGear Admin Wizard} open
|
||||||
xywh {186 521 465 435} type Double visible
|
xywh {187 544 465 435} type Double visible
|
||||||
} {
|
} {
|
||||||
Fl_Button quit_b {
|
Fl_Button quit_b {
|
||||||
label Quit
|
label Quit
|
||||||
|
|
|
@ -25,13 +25,17 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# include <direct.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <FL/Fl_File_Chooser.H>
|
#include <FL/Fl_File_Chooser.H>
|
||||||
#include <plib/ul.h>
|
#include <plib/ul.h>
|
||||||
|
|
||||||
#include <simgear/misc/sg_path.hxx>
|
#include <simgear/misc/sg_path.hxx>
|
||||||
|
|
||||||
#include "fgadmin.h"
|
#include "fgadmin.h"
|
||||||
#include "tar_utils.hxx"
|
#include "untarka.h"
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
@ -221,13 +225,13 @@ void FGAdminUI::install_selected() {
|
||||||
char *f;
|
char *f;
|
||||||
|
|
||||||
// traverse install box and install each item
|
// traverse install box and install each item
|
||||||
for ( int i = 0; i < install_box->nitems(); ++i ) {
|
for ( int i = 0; i <= install_box->nitems(); ++i ) {
|
||||||
if ( install_box->checked( i ) ) {
|
if ( install_box->checked( i ) ) {
|
||||||
f = install_box->text( i );
|
f = install_box->text( i );
|
||||||
SGPath file( source );
|
SGPath file( source );
|
||||||
file.append( f );
|
file.append( f );
|
||||||
cout << "installing " << file.str() << endl;
|
cout << "installing " << file.str() << endl;
|
||||||
tarextract( (char *)file.c_str(), (char *)dest.c_str(), true );
|
tarextract( (char *)file.c_str(), (char *)dest.c_str(), true, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +267,7 @@ void FGAdminUI::remove_selected() {
|
||||||
char *f;
|
char *f;
|
||||||
|
|
||||||
// traverse remove box and recursively remove each item
|
// traverse remove box and recursively remove each item
|
||||||
for ( int i = 0; i < remove_box->nitems(); ++i ) {
|
for ( int i = 0; i <= remove_box->nitems(); ++i ) {
|
||||||
if ( remove_box->checked( i ) ) {
|
if ( remove_box->checked( i ) ) {
|
||||||
f = remove_box->text( i );
|
f = remove_box->text( i );
|
||||||
SGPath dir( dest );
|
SGPath dir( dest );
|
||||||
|
|
|
@ -1,136 +0,0 @@
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <tar.h>
|
|
||||||
|
|
||||||
#include <libtar.h>
|
|
||||||
#include <zlib.h>
|
|
||||||
|
|
||||||
#include "tar_utils.hxx"
|
|
||||||
|
|
||||||
|
|
||||||
int gzopen_frontend( char *pathname, int oflags, int mode ) {
|
|
||||||
char *gzoflags;
|
|
||||||
gzFile gzf;
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
switch (oflags & O_ACCMODE)
|
|
||||||
{
|
|
||||||
case O_WRONLY:
|
|
||||||
gzoflags = "wb";
|
|
||||||
break;
|
|
||||||
case O_RDONLY:
|
|
||||||
gzoflags = "rb";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
case O_RDWR:
|
|
||||||
errno = EINVAL;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fd = open(pathname, oflags, mode);
|
|
||||||
if (fd == -1)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if ((oflags & O_CREAT) && fchmod(fd, mode))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
gzf = gzdopen(fd, gzoflags);
|
|
||||||
if (!gzf) {
|
|
||||||
errno = ENOMEM;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (int)gzf;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
tartype_t gztype = {
|
|
||||||
(openfunc_t) gzopen_frontend,
|
|
||||||
(closefunc_t) gzclose,
|
|
||||||
(readfunc_t) gzread,
|
|
||||||
(writefunc_t) gzwrite
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// list the contents of the specified tar file
|
|
||||||
bool tarlist( char *tarfile, char *destdir, bool verbose ) {
|
|
||||||
TAR *t;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
int tarflags = TAR_GNU;
|
|
||||||
if ( verbose ) {
|
|
||||||
tarflags |= TAR_VERBOSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( tar_open( &t, tarfile, &gztype, O_RDONLY, 0, tarflags ) == -1) {
|
|
||||||
fprintf(stderr, "tar_open(): %s\n", strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((i = th_read(t)) == 0) {
|
|
||||||
th_print_long_ls(t);
|
|
||||||
#ifdef DEBUG
|
|
||||||
th_print(t);
|
|
||||||
#endif
|
|
||||||
if (TH_ISREG(t) && tar_skip_regfile(t) != 0) {
|
|
||||||
fprintf(stderr, "tar_skip_regfile(): %s\n",
|
|
||||||
strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf( "th_read() returned %d\n", i);
|
|
||||||
printf( "EOF mark encountered after %ld bytes\n",
|
|
||||||
gzseek((gzFile) t->fd, 0, SEEK_CUR)
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (tar_close(t) != 0) {
|
|
||||||
fprintf(stderr, "tar_close(): %s\n", strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// extract the specified tar file into the specified destination
|
|
||||||
// directory
|
|
||||||
int tarextract( char *tarfile, char *destdir, bool verbose ) {
|
|
||||||
TAR *t;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
puts("opening tarfile...");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int tarflags = TAR_GNU;
|
|
||||||
if ( verbose ) {
|
|
||||||
tarflags |= TAR_VERBOSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( tar_open(&t, tarfile, &gztype, O_RDONLY, 0, tarflags) == -1 ) {
|
|
||||||
fprintf(stderr, "tar_open(): %s\n", strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
puts("extracting tarfile...");
|
|
||||||
#endif
|
|
||||||
if (tar_extract_all(t, destdir) != 0) {
|
|
||||||
fprintf(stderr, "tar_extract_all(): %s\n", strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
puts("closing tarfile...");
|
|
||||||
#endif
|
|
||||||
if (tar_close(t) != 0) {
|
|
||||||
fprintf(stderr, "tar_close(): %s\n", strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
1464
utils/fgadmin/src/untarka.c
Normal file
1464
utils/fgadmin/src/untarka.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -3,8 +3,8 @@
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
// list the contents of the specified tar file
|
// list the contents of the specified tar file
|
||||||
bool tarlist( char *tarfile, char *destdir, bool verbose );
|
// bool tarlist( char *tarfile, char *destdir, bool verbose );
|
||||||
|
|
||||||
// extract the specified tar file into the specified destination
|
// extract the specified tar file into the specified destination
|
||||||
// directory
|
// directory
|
||||||
int tarextract( char *tarfile, char *destdir, bool verbose );
|
extern "C" void tarextract( char *tarfile, char *destdir, int verbose, void (*step)(void) );
|
27
utils/fgadmin/visualc/fgadmin.sln
Normal file
27
utils/fgadmin/visualc/fgadmin.sln
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 7.00
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fgadmin", "fgadmin\fgadmin.vcproj", "{7004E589-7EA0-4AFD-B432-3D5E00B55049}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "untarka", "untarka\untarka.vcproj", "{9FC55559-6801-4537-BAA3-D145B1B5A2F8}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfiguration) = preSolution
|
||||||
|
ConfigName.0 = Debug
|
||||||
|
ConfigName.1 = Release
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectDependencies) = postSolution
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfiguration) = postSolution
|
||||||
|
{7004E589-7EA0-4AFD-B432-3D5E00B55049}.Debug.ActiveCfg = Debug|Win32
|
||||||
|
{7004E589-7EA0-4AFD-B432-3D5E00B55049}.Debug.Build.0 = Debug|Win32
|
||||||
|
{7004E589-7EA0-4AFD-B432-3D5E00B55049}.Release.ActiveCfg = Release|Win32
|
||||||
|
{7004E589-7EA0-4AFD-B432-3D5E00B55049}.Release.Build.0 = Release|Win32
|
||||||
|
{9FC55559-6801-4537-BAA3-D145B1B5A2F8}.Debug.ActiveCfg = Debug|Win32
|
||||||
|
{9FC55559-6801-4537-BAA3-D145B1B5A2F8}.Debug.Build.0 = Debug|Win32
|
||||||
|
{9FC55559-6801-4537-BAA3-D145B1B5A2F8}.Release.ActiveCfg = Release|Win32
|
||||||
|
{9FC55559-6801-4537-BAA3-D145B1B5A2F8}.Release.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
138
utils/fgadmin/visualc/fgadmin/fgadmin.vcproj
Normal file
138
utils/fgadmin/visualc/fgadmin/fgadmin.vcproj
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
<?xml version="1.0" encoding = "Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="7.00"
|
||||||
|
Name="fgadmin"
|
||||||
|
ProjectGUID="{7004E589-7EA0-4AFD-B432-3D5E00B55049}"
|
||||||
|
Keyword="Win32Proj">
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"/>
|
||||||
|
</Platforms>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="Debug"
|
||||||
|
IntermediateDirectory="Debug"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="2">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\..\..\..\fltk-1.1.4"
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_ZLIB"
|
||||||
|
MinimalRebuild="TRUE"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="TRUE"
|
||||||
|
DebugInformationFormat="4"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="fltkd.lib Simgear_d.lib ul_d.lib comctl32.lib wsock32.lib zlib.lib"
|
||||||
|
OutputFile="$(OutDir)/fgadmin.exe"
|
||||||
|
LinkIncremental="2"
|
||||||
|
AdditionalLibraryDirectories=""..\..\..\..\fltk-1.1.4\lib""
|
||||||
|
GenerateDebugInformation="TRUE"
|
||||||
|
ProgramDatabaseFile="$(OutDir)/fgadmin.pdb"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="Release"
|
||||||
|
IntermediateDirectory="Release"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="2">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
InlineFunctionExpansion="1"
|
||||||
|
OmitFramePointers="TRUE"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||||
|
StringPooling="TRUE"
|
||||||
|
RuntimeLibrary="4"
|
||||||
|
EnableFunctionLevelLinking="TRUE"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="TRUE"
|
||||||
|
DebugInformationFormat="3"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
OutputFile="$(OutDir)/fgadmin.exe"
|
||||||
|
LinkIncremental="1"
|
||||||
|
GenerateDebugInformation="TRUE"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\fgadmin.cxx">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\fgadmin_funcs.cxx">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\main.cxx">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\untarka.c">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl;inc">
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\fgadmin.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\tar_utils.hxx">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
Loading…
Reference in a new issue