PackageManager: Bug fix

svn path=/trunk/; revision=14590
This commit is contained in:
Maarten Bosma 2005-04-11 17:59:52 +00:00
parent 4b77a4d92d
commit abd513250f
6 changed files with 43 additions and 26 deletions

View file

@ -26,35 +26,48 @@ HRESULT WINAPI URLDownloadToFileA(
LPBINDSTATUSCALLBACK lpfnCB
);
int FindCount (string What, string Where, int start = 0, int end = -1);
// Download a file
char* PML_Download (const char* name, const char* local_name = "packmgr.txt", const char* server = tree_server, BOOL totemp = TRUE)
char* PML_Download (const char* url, const char* server = "tree", const char* filename = NULL)
{
char url [MAX_PATH];
static char path [MAX_PATH];
char downl [MAX_PATH];
static char path [MAX_PATH];
// get temp dir
if(totemp)
if(!filename)
GetTempPathA (200, path);
else if(!strstr(filename, "\\"))
GetTempPathA (200, path);
// create the local file name
if(local_name)
strcat(path, local_name);
if(filename)
{
strcat(path, filename);
DeleteFileA (path);
}
else
strcat(path, "tmp.tmp");
GetTempFileNameA (path, "pml", 0, path);
// get the url
if(server) strcpy(url, server);
strcat(url, name);
// make sure there is no old file
DeleteFileA (path);
if (!server);
else if(!strcmp(server, "tree"))
strcpy(downl, tree_server);
else
strcpy(downl, server);
strcat(downl, url);
// download the file
if(URLDownloadToFileA (NULL, url, path, 0, NULL) != S_OK)
if(URLDownloadToFileA (NULL, downl, path, 0, NULL) != S_OK)
{
Log("! ERROR: Unable to download ");
LogAdd(url);
LogAdd(downl);
return NULL;
}

View file

@ -14,6 +14,10 @@ BEGIN
ERR_SYNATX "Error durante la ejecución del Script.\nSintaxis errónea."
ERR_CALL "Error durante la ejecución del Script.\nNo se pudo encontrar la función."
ERR_PARAMETER "Error durante la ejecución del Script.\nParametro(s) erróneo."
ERR_DEP1 "To install this package you have to install the following package(s) as well:\n\n"
ERR_DEP2 "\nDo you want this ?"
ERR_READY "You choosen to install %d package(s). To install them you have to read and agree with each of thier licences.\n\n Do you want still want to ?"
END
/* EOF */

View file

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////
//
// script.cpp
// functions.cpp
//
// Script Functions
//
@ -15,7 +15,7 @@
#include "log.h"
extern const char* tree_server;
char* PML_Download (const char* name, const char* local_name, const char* server, BOOL totemp = TRUE);
char* PML_Download (const char* url, const char* server, const char* filename);
int debuglog (int argc, char* argv[])
@ -31,10 +31,10 @@ int download (int argc, char* argv[])
char* result;
if (argc==3)
result = PML_Download(argv[1], argv[2], argv[3]);
result = PML_Download(argv[1], argv[3], argv[2]);
else if (argc==2)
result = PML_Download(argv[1], argv[2], NULL);
result = PML_Download(argv[1], NULL, argv[2]);
else
return ERR_GENERIC;

View file

@ -19,8 +19,7 @@
HANDLE hThread = NULL;
BOOL thread_abort = FALSE;
extern const char* tree_server;
char* PML_Download (const char* name, const char* local_name = "packmgr.txt", const char* server = tree_server, BOOL totemp = TRUE);
char* PML_Download (const char* url, const char* server = "tree", const char* filename = NULL);
// Abort other thread

View file

@ -169,7 +169,7 @@ extern "C" int PML_SetAction (TREE* tree, int id, int action, PML_SetIcon SetIco
UINT count = pack->depencies.size();
WCHAR buffer[2000], buffer2[200];
wcscpy(buffer, PML_TransError(ERR_DEP1));
for (i=0; i<pack->depencies.size(); i++)
{
int item = PML_FindItem(tree, pack->depencies[i]);
@ -190,16 +190,18 @@ extern "C" int PML_SetAction (TREE* tree, int id, int action, PML_SetIcon SetIco
wcscat(buffer, PML_TransError(ERR_DEP2));
if(count)
{
if(!Ask(buffer))
return ERR_GENERIC;
for (i=0; i<pack->depencies.size(); i++)
{
int item = PML_FindItem(tree, pack->depencies[i]);
for (i=0; i<pack->depencies.size(); i++)
{
int item = PML_FindItem(tree, pack->depencies[i]);
tree->packages[item].neededBy.push_back(id);
tree->packages[item].neededBy.push_back(id);
PML_SetAction(tree, item, action, SetIcon, Ask);
PML_SetAction(tree, item, action, SetIcon, Ask);
}
}
}

View file

@ -2,6 +2,5 @@
<name>MozillaControl</name>
<description>Provide the Gekko Engine for ReactOS.</description>
<scripts inst="mozillacontrol.inst.rps" srcinst="mozillacontrol.inst.rps"/>
<depent>abiword</depent>
</package>