mirror of
https://github.com/reactos/reactos.git
synced 2025-05-25 20:18:22 +00:00
PackageManager: Bug fix
svn path=/trunk/; revision=14590
This commit is contained in:
parent
4b77a4d92d
commit
abd513250f
6 changed files with 43 additions and 26 deletions
|
@ -26,35 +26,48 @@ HRESULT WINAPI URLDownloadToFileA(
|
||||||
LPBINDSTATUSCALLBACK lpfnCB
|
LPBINDSTATUSCALLBACK lpfnCB
|
||||||
);
|
);
|
||||||
|
|
||||||
|
int FindCount (string What, string Where, int start = 0, int end = -1);
|
||||||
|
|
||||||
|
|
||||||
// Download a file
|
// 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];
|
char downl [MAX_PATH];
|
||||||
static char path [MAX_PATH];
|
static char path [MAX_PATH];
|
||||||
|
|
||||||
// get temp dir
|
// get temp dir
|
||||||
if(totemp)
|
if(!filename)
|
||||||
|
GetTempPathA (200, path);
|
||||||
|
|
||||||
|
else if(!strstr(filename, "\\"))
|
||||||
GetTempPathA (200, path);
|
GetTempPathA (200, path);
|
||||||
|
|
||||||
// create the local file name
|
// create the local file name
|
||||||
if(local_name)
|
if(filename)
|
||||||
strcat(path, local_name);
|
{
|
||||||
|
strcat(path, filename);
|
||||||
|
DeleteFileA (path);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
strcat(path, "tmp.tmp");
|
GetTempFileNameA (path, "pml", 0, path);
|
||||||
|
|
||||||
// get the url
|
// get the url
|
||||||
if(server) strcpy(url, server);
|
|
||||||
strcat(url, name);
|
|
||||||
|
|
||||||
// make sure there is no old file
|
if (!server);
|
||||||
DeleteFileA (path);
|
|
||||||
|
else if(!strcmp(server, "tree"))
|
||||||
|
strcpy(downl, tree_server);
|
||||||
|
|
||||||
|
else
|
||||||
|
strcpy(downl, server);
|
||||||
|
|
||||||
|
strcat(downl, url);
|
||||||
|
|
||||||
// download the file
|
// 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 ");
|
Log("! ERROR: Unable to download ");
|
||||||
LogAdd(url);
|
LogAdd(downl);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,10 @@ BEGIN
|
||||||
ERR_SYNATX "Error durante la ejecución del Script.\nSintaxis errónea."
|
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_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_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
|
END
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// script.cpp
|
// functions.cpp
|
||||||
//
|
//
|
||||||
// Script Functions
|
// Script Functions
|
||||||
//
|
//
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
extern const char* tree_server;
|
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[])
|
int debuglog (int argc, char* argv[])
|
||||||
|
@ -31,10 +31,10 @@ int download (int argc, char* argv[])
|
||||||
char* result;
|
char* result;
|
||||||
|
|
||||||
if (argc==3)
|
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)
|
else if (argc==2)
|
||||||
result = PML_Download(argv[1], argv[2], NULL);
|
result = PML_Download(argv[1], NULL, argv[2]);
|
||||||
|
|
||||||
else
|
else
|
||||||
return ERR_GENERIC;
|
return ERR_GENERIC;
|
||||||
|
|
|
@ -19,8 +19,7 @@
|
||||||
HANDLE hThread = NULL;
|
HANDLE hThread = NULL;
|
||||||
BOOL thread_abort = FALSE;
|
BOOL thread_abort = FALSE;
|
||||||
|
|
||||||
extern const char* tree_server;
|
char* PML_Download (const char* url, const char* server = "tree", const char* filename = NULL);
|
||||||
char* PML_Download (const char* name, const char* local_name = "packmgr.txt", const char* server = tree_server, BOOL totemp = TRUE);
|
|
||||||
|
|
||||||
|
|
||||||
// Abort other thread
|
// Abort other thread
|
||||||
|
|
|
@ -169,7 +169,7 @@ extern "C" int PML_SetAction (TREE* tree, int id, int action, PML_SetIcon SetIco
|
||||||
UINT count = pack->depencies.size();
|
UINT count = pack->depencies.size();
|
||||||
WCHAR buffer[2000], buffer2[200];
|
WCHAR buffer[2000], buffer2[200];
|
||||||
wcscpy(buffer, PML_TransError(ERR_DEP1));
|
wcscpy(buffer, PML_TransError(ERR_DEP1));
|
||||||
|
|
||||||
for (i=0; i<pack->depencies.size(); i++)
|
for (i=0; i<pack->depencies.size(); i++)
|
||||||
{
|
{
|
||||||
int item = PML_FindItem(tree, pack->depencies[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));
|
wcscat(buffer, PML_TransError(ERR_DEP2));
|
||||||
|
|
||||||
if(count)
|
if(count)
|
||||||
|
{
|
||||||
if(!Ask(buffer))
|
if(!Ask(buffer))
|
||||||
return ERR_GENERIC;
|
return ERR_GENERIC;
|
||||||
|
|
||||||
for (i=0; i<pack->depencies.size(); i++)
|
for (i=0; i<pack->depencies.size(); i++)
|
||||||
{
|
{
|
||||||
int item = PML_FindItem(tree, pack->depencies[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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,5 @@
|
||||||
<name>MozillaControl</name>
|
<name>MozillaControl</name>
|
||||||
<description>Provide the Gekko Engine for ReactOS.</description>
|
<description>Provide the Gekko Engine for ReactOS.</description>
|
||||||
<scripts inst="mozillacontrol.inst.rps" srcinst="mozillacontrol.inst.rps"/>
|
<scripts inst="mozillacontrol.inst.rps" srcinst="mozillacontrol.inst.rps"/>
|
||||||
<depent>abiword</depent>
|
|
||||||
</package>
|
</package>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue